1
我正在尝试使用Maven插件为JMeter测试设置属性。我已按照我的pom.xml
文件中的推荐设置从this question的答案中进行了操作,但运行测试时未收到我的属性。从Maven插件设置JMeter属性
的pom.xml
的相关部分:
<profiles>
<profile>
<id>jmeter-test</id>
<build>
<plugins>
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>2.0.3</version>
<executions>
<execution>
<id>jmeter-tests</id>
<goals>
<goal>jmeter</goal>
</goals>
<configuration>
<propertiesUser>
<threadCount>5</threadCount>
<environment>test</environment>
</propertiesUser>
<testResultsTimestamp>false</testResultsTimestamp>
<proxyConfig>
<host>localhost</host>
<port>8888</port>
</proxyConfig>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
我试图访问使用我的JMeter的测试变量:${__P(threadCount)}
和${__P(environment)}
。
在运行时,我使用
mvn clean verify -Pjmeter-tests
我可以看到代理配置拾起并使用从输出:
[INFO] -------------------------------------------------------
[INFO] 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] Proxy Details:
Host: localhost:8888
[INFO]
[INFO] Executing test: JMeterTests.jmx
不幸的是,propertiesUser
值没有得到用过的。我也能够使用命令行亚军,它按预期工作:
jmeter -n -t JMeterTests.jmx -Jenvironment=test -JthreadCount=5
任何想法,为什么这不工作?
更多信息: 我已经测试出使用example project,并看到预期的行为是<propertiesUser>
下的配置应该是填充文件target/jmeter/bin/user.properties
。这没有发生,该文件根本没有被创建。