我在使用Maven执行Jmeter脚本时遇到问题: Maven版本:3.2.1 Jmeter版本:2.11 我还尝试使用“mvn Jmeter:Jmeter -DexformancethreadCount = 3在命令行中运行Jmeter脚本,但在两者中都遇到相同的错误(命令行和使用Jenkins)
Failed to execute goal com.lazerycode.jmeter:jmeter-maven-plugin:1.10.0:jmeter (default-cli) on project Jmeter_Integration: D:\svn_workspace\Jmeter_Integration\target\jmeter\results\Jmeter_Jenkins.jtl (The system cannot find the file specified) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Build step 'Invoke top-level Maven targets' marked build as failure
<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>Jmeter_Integration</groupId>
<artifactId>Jmeter_Integration</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Jmeter_Integration</name>
<url>http://maven.apache.org</url>
<build>
<plugins>
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>1.10.0</version>
<configuration>
<testResultsTimestamp>false</testResultsTimestamp>
<propertiesUser>
<threadCount>${performancetest.threadCount}</threadCount>
</propertiesUser>
<propertiesJMeter>
<jmeter.save.saveservice.thread_counts>true</jmeter.save.saveservice.thread_counts>
</propertiesJMeter>
</configuration>
<executions>
<execution>
<id>jmeter-tests</id>
<phase>verify</phase>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
如果我遗漏任何配置,请提供指导或解决方案或告诉我。
谢谢..
答案 0 :(得分:0)
我可以看到您的配置有两个问题:
mvn JMeter:JMeter
命令无法正常工作你有
performancetest.threadCount
- 在&#34; pom.xml&#34; performancethreadCount
- 在命令行中并且这些属性名称必须是相同。
按照以下步骤解决您的问题:
在JMeter's Thread Group中定义&#34;线程数&#34;如
${__P(threadCount,)}
您的测试结构应如下所示:
执行测试:
mvn -Dperformancetest.threadCount = 3 clean verify
或
mvn -Dperformancetest.threadCount=3 clean install
有关一般信息,请参阅JMeter Maven Plugin wiki页面;有关Maven驱动的其他提示以及有关如何执行JMeter测试的其他选项,请参阅Five Ways To Launch a JMeter Test without Using the JMeter GUI指南。