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
。這沒有發生,該文件根本沒有被創建。