我在 Jmeter 上构建了一个测试计划并从 maven 运行它。但是当我在 Jmeter 中指定的 Maven 上运行测试时,我不知道如何从命令行获取这些用户定义的变量。例如,我已经使用“${__P(users)}”定义了 jmeter 中的线程数字段,或者我有一些 if 控制器条件来运行特定线程。并用 "${__P(tiff)}" == "true" 指定 if 控制器的 if 条件。
所以
我在pom.xml中的依赖和插件如下:
<dependencies>
<dependency>
<groupId>org.jvnet.hudson.plugins</groupId>
<artifactId>jmeter</artifactId>
<version>0.3.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>1.9.1</version>
<executions>
<execution>
<id>jmeter-tests</id>
<phase>verify</phase>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Run Code Online (Sandbox Code Playgroud) 我正在编写一个 JMeter 套件来运行在 Jenkins 之上并使用jmeter-graph-maven-plugin生成图表。
测试正在使用jmeter-maven-plugin 执行并生成 jmeter-graph 插件期望的相应 *.jtl 文件。
当我在 pom.xml 上声明它们时,我想知道可以通过jmeter-graph-maven-plugin生成的所有类型的图:
<graph>
<pluginType>ThreadsStateOverTime</pluginType>
<width>800</width>
<height>600</height>
<outputFile>${project.build.directory}/jmeter/results/ThreadsStateOverTime.png</outputFile>
</graph>
Run Code Online (Sandbox Code Playgroud)
是否有所有可能的综合清单 我可以使用的条目?
谢谢,
尼尔
我试图弄清楚如何有条件地执行我的JMeter性能测试计划.我想让我的Jenkins CI作业执行它,但是当开发人员运行时mvn clean install我不想让下面的插件运行.关于如何修改我的pom.xml以有条件地运行以下插件的任何想法?
Maven POM.xml JMeter插件:
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>1.8.1</version>
<executions>
<execution>
<id>jmeter-tests</id>
<phase>verify</phase>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
</executions>
<configuration>
<testFilesDirectory>${project.basedir}/src/test/jmeter</testFilesDirectory>
<ignoreResultFailures>true</ignoreResultFailures>
<testResultsTimestamp>false</testResultsTimestamp>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>transform</goal>
</goals>
</execution>
</executions>
<configuration>
<transformationSets>
<transformationSet>
<dir>${project.build.directory}/jmeter/results</dir>
<stylesheet>${project.basedir}/src/test/resources/jmeter-results-detail-report_21.xsl</stylesheet>
<outputDir>${project.build.directory}/jmeter/results</outputDir>
<fileMappers>
<fileMapper implementation="org.codehaus.plexus.components.io.filemappers.RegExpFileMapper">
<pattern>(.*?)\s(.*?)</pattern>
<replacement>$1$2</replacement>
<replaceAll>true</replaceAll>
</fileMapper>
<fileMapper implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
<targetExtension>.html</targetExtension>
</fileMapper>
</fileMappers>
</transformationSet>
</transformationSets>
</configuration>
</plugin>
<plugin>
<groupId>ch.fortysix</groupId>
<artifactId>maven-postman-plugin</artifactId>
<version>0.1.2</version>
<executions>
<execution>
<id>send a mail</id>
<phase>install</phase>
<goals>
<goal>send-mail</goal>
</goals>
<inherited>false</inherited>
<configuration>
<from>admin@test.com</from>
<subject>Load Test …Run Code Online (Sandbox Code Playgroud) 我是詹金斯(Hudson Build)的新手.我没有任何想法如何将Jmeter脚本与安装在Ubuntu上的jenkins集成.我研究了很多,但只能找到jenkins基于GUI的步骤.任何人都可以帮助我使用命令行步骤将Jmeter与jenkins集成.我需要将Jmeter集成为一个独立的任务.我通过Putty和Winscp使用EC2实例.
提前致谢 .
简而言之,如果我从 Maven 运行下面的 JMeter 计划测试,它会给出结果:
javax.naming.NamingException: javax.naming.NoInitialContextException: Cannot instantiate class: org.apache.activemq.jndi.ActiveMQInitialContextFactory [Root exception is java.lang.ClassNotFoundException: org.apache.activemq.jndi.ActiveMQInitialContextFactory]
Run Code Online (Sandbox Code Playgroud)
尽管如此,如果我在没有 maven 插件的情况下运行相同的 JMeter 计划测试,它会正确运行。
提供更多细节:
如果我以这种方式启动 ActiveMQ(Windows 命令提示符):
cd C:\_d\server\ActiveMQ\apache-activemq-5.9.0\bin
activemq.bat
Run Code Online (Sandbox Code Playgroud)
然后,我以这种方式运行完全相同的 jmx 脚本:
jmeter.bat -n -t C:\_d\scripts\JMeter\JMS_SQS_MVN\SQS.jmx -l C:\temp\activemq.jtl -j C:\temp\activemq.jmx.log
Run Code Online (Sandbox Code Playgroud)
我可以转到 ActiveMq 控制台并查看创建的标记为 sqs_dummy_mvn6 的队列,因为它出现在此类 jmx 脚本中。
现在,使用相同的脚本但通过 maven 插件,它只是显示“无法实例化类:org.apache.activemq.jndi.ActiveMQInitialContextFactory”。好吧,我明白,每当我使用 jmeter-maven-plugin 时,都会在验证阶段启动和停止嵌入式 jmeter 和嵌入式 activemq。
我通过 maven 调用相同的脚本:
mvn clean verify
Run Code Online (Sandbox Code Playgroud)
...\artproducer\src\test\jmeter\SQS.jmx(下面只启用发布者;禁用订阅以使测试更简单)
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="2.9" jmeter="3.0 r1743807">
<hashTree>
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Plano de Teste SQS" enabled="true">
<stringProp name="TestPlan.comments"></stringProp> …Run Code Online (Sandbox Code Playgroud) Jmeter Maven 插件 1.4 用于生成漂亮的 HTML 报告,但最新的插件 2.1.0 没有创建。我知道默认情况下,最新插件的 enableReports 设置为 false。
我想知道如何在不使用 pom.xml 中的任何其他插件的情况下启用 HTML 报告?
或者
哪个插件与可用于生成 HTML 报告的 Jmeter Maven 插件 2.1.0 兼容?
提前致谢。
使用 JMeter-Maven 插件运行 JMeter 脚本时收到错误“生成报告时出错:java.lang.NullPointerException”。
下面是我的 pom.xml 文件:
http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 com.branch.performance simpleAccess 0.0.1-SNAPSHOT
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!--Access Portal Login page URL -->
<AccessLoginPageURL>test-login.com</AccessLoginPageURL>
<!-- base URL -->
<BaseURL>test.branch.com</BaseURL>
<!-- Number of users to simulate to execute the performance test plan -->
<numberOfUsers>3</numberOfUsers>
<!-- Time in seconds to get all users activated -->
<rampupTimeInSeconds>1</rampupTimeInSeconds>
<!-- Number of times the plan executed by every user -->
<numberOfLoops>1</numberOfLoops>
<apdexSatisfiedThreshold>2000</apdexSatisfiedThreshold>
<apdexToleratedThreshold>4000</apdexToleratedThreshold>
<!-- JMeter Dashboard output file report name -->
<jmeterReportTitle>Performance Dashboard</jmeterReportTitle>
</properties> …Run Code Online (Sandbox Code Playgroud) 我通过 maven jmeter 插件成功生成了一个 jmeter 仪表板。我在 Jenkins 上配置了这个构建来运行,它也成功生成了仪表板,并显示了所有图形/数据。我现在尝试使用 HTML 发布器发布此仪表板,以便可以从 Jenkins 构建访问它。该插件正常工作并将生成的仪表板和所有必需的文件夹/文件移动到存档位置,并在构建页面上显示一个指向 index.html 的链接。
但是,如果我单击该链接,它会打开索引页面,但所有内容都是空的……仅显示标题/导航,例如: 通过 jenkins 清空仪表板 。如果我通过构建服务器打开完全相同的仪表板索引页面,它会显示正常,并且一切都会显示并正常工作。
我在 jenkins.xml 中添加了以下内容,希望它是 css 等权限问题:
-Dhudson.model.DirectoryBrowserSupport.CSP=
但这并没有起到任何作用。
任何想法为什么 jmeter 仪表板报告可能无法通过 Jenkins 正确显示,但在通过服务器直接访问时却显示正确?作为旁注,我还以完全相同的方式发布 jacoco 和 surefire 报告,并且它们显示良好。我也在使用性能插件,它还可以从 jmeter 中提取数据并显示一些图表……但我也希望漂亮的仪表板能够正常工作。
谢谢!
jmeter ×7
maven ×5
jenkins ×4
java ×2
hudson ×1
jmeter-5.0 ×1
jndi ×1
load-testing ×1
pom.xml ×1