我需要设置由CI系统自动触发的性能测试.为此,我想使用JMeter,因为一些脚本和经验已经存在,我想将它与Maven结合起来.
在我研究一个合理的插件时,我发现存在两个插件:
哪一个更好用?两者似乎都在维持并正在开发中.有这方面的经验吗?甚至配置也类似.
我很乐意得到一些提示,以帮助我决定,而不是玩两个插件几天.
从jmeter-maven-plugin执行JMeter时是否可以使用JMeter 插件?
UPDATE
我已经尝试将jmeter-plugins依赖项添加到插件定义中,根据Ardesco的有用答案,但我得到了无数的ClassNotFoundExceptions.它看起来像Maven是不是把jmeter-plugin执行的JMeter时的传递依赖的类路径.有任何想法吗?
我有一个由Maven执行的Jmeter项目,并且能够通过路径找到外部Beanshell脚本src/test/jmeter/external-scripts-dir/script1.bsh,但是当我在计算机上的GUI中直接运行Jmeter时,相对位置不起作用,并且测试不能单独运行.这迫使我从Maven运行Jmeter.
所以,我有一个位于Maven布局位置的项目文件,C:\files\git\projectA\src\test\jmeter\Project.jmx但是因为我从安装文件夹中运行jmeter C:\Jmeter2.12,它找不到我前面提到的外部脚本的相对位置.
要解决这个问题,我需要的是将变量设置为包含.jmx文件的目录.有没有办法做到这一点?
我可以C:\Jmeter2.12很容易地动态确定Jmeter()的主页(使用下面的代码),但这并没有帮助我获得项目文件的位置.
${__BeanShell(import org.apache.jmeter.services.FileServer; FileServer
.getFileServer().getBaseDir();)}${__BeanShell(File.separator,)}
Run Code Online (Sandbox Code Playgroud)
有没有类似于上面的代码,可以让我推断出项目文件的位置?
我有maven项目,在我的帮助下我试图执行一个jmx文件,运行JMeter(jmeter-maven-plugin).我有以下控制台输出
P E R F O R M A N C E T E S T S
[INFO] -------------------------------------------------------
[INFO] Invalid value detected for <postTestPauseInSeconds>. Setting pause to 0...
[INFO]
[INFO]
[INFO] Executing test: ZawyaJmeterTest.jmx
[INFO] Writing log file to: D:\tools\jmeter_examples\Example\jmeter-maven-example\target\jmeter\logs\ZawyaJmeterTest.jmx.log
[INFO] Error in NonGUIDriver java.lang.IllegalArgumentException: Problem loading XML from:'D:\tools\jmeter_examples\Example\jmeter-maven-example\target\jmeter\testFiles\ZawyaJmeterTest.jmx', missing class com.thoughtworks.xstream.converters.ConversionException: No field 'sentBytes' found in class 'org.apache.jmeter.samplers.SampleSaveConfiguration' : No field 'sentBytes' found in class 'org.apache.jmeter.samplers.SampleSaveConfiguration'
Run Code Online (Sandbox Code Playgroud)
我想为了解决这个问题, org.apache.jmeter.samplers.SampleSaveConfiguration我尝试在依赖项中添加SampleSaveConfiguration类
<dependency>
<groupId>org.apache.jmeter</groupId>
<artifactId>ApacheJMeter_core</artifactId>
<version>3.1</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
但实际上并没有帮助.比我寻找问题No field 'sentBytes' …
我们正在使用,maven-jmeter-plugin并且已经设置了jmeter配置文件。当我运行mvn -Pjmeter verify各种Maven生命周期时,它们都不需要运行。
如何仅运行JMeter测试?
<profile>
<id>jmeter</id>
<build>
<plugins>
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>${jmeter.version}</version>
<executions>
<execution>
<id>jmeter-tests</id>
<phase>verify</phase>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
</executions>
<configuration>
<testResultsTimestamp>false</testResultsTimestamp>
</configuration>
</plugin>
</plugins>
</build>
</profile>
Run Code Online (Sandbox Code Playgroud) 我正在使用com.lazerycode.jmeter:jmeter-maven-plugin对Apache JMeter进行Web应用程序的性能测试。由于版本3.2带来了许多更改,我想知道是否可以在jmeter-maven-plugin中使用该版本(这不是Apache JMeter-project的一部分)。
我尝试了以下方法:
<build>
<plugins>
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>2.1.0</version>
<configuration>
<jmeterVersion>3.2</jmeterVersion>
<jMeterProcessJVMSettings>
<xms>1024</xms>
<xmx>1024</xmx>
<arguments>
<argument>-Xprof</argument>
<argument>-Xfuture</argument>
</arguments>
</jMeterProcessJVMSettings>
</configuration>
<executions>
<execution>
<id>jmeter-tests</id>
<phase>test</phase>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Run Code Online (Sandbox Code Playgroud)
jmeter-maven-plugin中的jmeter的标准版本是3.1。我发现这是为了指定库:https : //github.com/jmeter-maven-plugin/jmeter-maven-plugin/wiki/Specifying-JMeter-Version
上面的配置对我不起作用。我得到了NPE(空指针异常)。
[INFO] >>> jmeter-maven-plugin:2.1.0:jmeter (jmeter-tests) > :configure @ EAdresseBatchImportCapacityTests >>>
[INFO]
[INFO] --- jmeter-maven-plugin:2.1.0:configure (configure) @ EAdresseBatchImportCapacityTests ---
[INFO] -------------------------------------------------------
[INFO] Configuring JMeter...
[INFO] -------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.136 s
[INFO] Finished at: 2017-04-28T13:28:40+02:00
[INFO] Final …Run Code Online (Sandbox Code Playgroud) 我正在使用JMeter的Maven插件(http://jmeter.lazerycode.com/).
在我的JMeter测试计划中,我定义了各种属性,例如hostName,threadCount等.
如果我从命令行使用标准的JMeter程序,我会指定如下属性:
jmeter -n -t mytest.jmx -JhostName=www.example.com -JthreadCount=5
Run Code Online (Sandbox Code Playgroud)
由于Maven JMeter插件是通过以下命令执行的:
mvn verify
Run Code Online (Sandbox Code Playgroud)
如何传递属性值?命令:
mvn verify -JhostName=www.example.com -JthreadCount=5
Run Code Online (Sandbox Code Playgroud)
似乎没有用.我一定错过了一些明显的东西
我正在尝试使用 java 代码运行 jmeter 脚本。我已经做了一个jmx。当我尝试运行代码时,我使用 jmeter 2.13,它向我显示此错误。
无法在项目 JmeterJson 上执行目标:无法解析项目 JmeterJson:JmeterJson:war:0.0.1-SNAPSHOT 的依赖项:无法解析以下工件:commons-math3:commons-math3:jar:3.4.1、commons- pool2:commons-pool2:jar:2.3: 无法在中心找到工件 commons-math3:commons-math3:jar:3.4.1 ( https://repo.maven.apache.org/maven2 ) -> [帮助 1] [错误]
我的 pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>JmeterJson</groupId>
<artifactId>JmeterJson</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<spring.version>4.0.0.RELEASE</spring.version>
<jdk.version>1.8</jdk.version>
<jackson.version>1.9.10</jackson.version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.jmeter</groupId>
<artifactId>ApacheJMeter_core</artifactId>
<version>2.13</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.apache.jmeter</groupId>
<artifactId>ApacheJMeter_http</artifactId>
<version>2.13</version>
<exclusions>
<exclusion>
<artifactId>commons-math3</artifactId>
<groupId>commons-math3</groupId>
</exclusion>
<exclusion>
<artifactId>commons-pool2</artifactId>
<groupId>commons-pool2</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- Jackson JSON Mapper --> …Run Code Online (Sandbox Code Playgroud) Maven clean install在以下位置生成新的html文件
/var/lib/jenkins/workspace/Docs_LoadTest/target/jmeter/reports/DocsJmeterTests_20170601_151330/index.html
每次运行时,"DocsJmeterTests_20170601_151330"都会发生变化.所以我试图使用发布html报告插件发布html报告.以下是我的管道脚本
node {
build job: 'Docs_LoadTest'
stage('Results') {
publishHTML([allowMissing: false,
alwaysLinkToLastBuild: true,
keepAll: true,
reportDir:
'/var/lib/jenkins/workspace/Docs_LoadTest/target/jmeter/reports/*/',
reportFiles: 'index.html',
reportName: 'Docs Loadtest Dashboard'
])
}
}
Run Code Online (Sandbox Code Playgroud)
运行作业时出现以下错误
[htmlpublisher]存档HTML报告...
[htmlpublisher]在BUILD级别存档/ var/lib/jenkins/workspace/Docs_LoadTest/target/jmeter/reports/*到/ var/lib/jenkins/jobs/Docs_Pipeline/builds/10/htmlreports/Docs_Loadtest_Dashboard
错误:指定的HTML目录'/ var/lib/jenkins/workspace/Docs_LoadTest/target/jmeter/reports/*'不存在.
即使我们尝试以下选项也没有奏效
/ var/lib/jenkins/workspace/Docs_LoadTest/target/jmeter/reports/**// var/lib/jenkins/workspace/Docs_LoadTest/target/jmeter/reports/DocsJmeterTests_*/var/lib/jenkins/workspace/Docs_LoadTest/target/jmeter/reports/DocsJmeterTests_*_*
jmeter jenkins jenkins-plugins jmeter-maven-plugin jenkins-pipeline
I am trying to run a Jmeter test on remote machine ( macOS sierraO).
I configured jp@gc - Chrome Driver Config and I can connect to the slave machine. However, whenever I try to run it I get
Starting ChromeDriver 73.0.3683.20 (XXXXXXX) on port XXXX
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
Mar 08, 2019 12:12:35 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
Using local port: …Run Code Online (Sandbox Code Playgroud)