我正在学习jmeter并尝试使用Maven配置它,但是当我运行" mvn verify -e"
时,我得到以下异常 [ERROR] Failed to execute goal com.lazerycode.jmeter:jmeter-maven- plugin:1.9.0:jmeter (jmeter-tests) on project jmeter: C:\qa\jmeter\target\jmeter\results\20150921-JmeterTests.jtl (The system cannot find the file specified) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.lazerycode.jmeter:jmeter-maven-plugin:1.9.0:jmeter (jmeter-tests) on project jmeter: C:\hass-git\cpp_ocp2\cpp_ocp2\qa\jmeter\target\jmeter\results\20150921-JmeterTests.jtl (The system cannot find the file specified)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: C:\qa\jmeter\target\jmeter\results\20150921-JmeterTests.jtl (The system cannot find the file specified)
at com.lazerycode.jmeter.JMeterMojo.parseTestResults(JMeterMojo.java:75)
at com.lazerycode.jmeter.JMeterMojo.execute(JMeterMojo.java:54)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 20 more
我的pom.xml有
<build>
<plugins>
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>1.9.0</version>
<executions>
<execution>
<id>jmeter-tests</id>
<phase>verify</phase>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
</executions>
<configuration>
</configuration>
</plugin>
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-analysis-maven-plugin</artifactId>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>analyze</goal>
</goals>
<configuration>
<source>${project.build.directory}/**/*.jtl</source>
<targetDirectory>${project.build.directory}/results</targetDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
我的文件夹结构是
qa/jmeter/src/test/jmeter/jmeterTests.jmx
答案 0 :(得分:1)
执行private class PhoneStateChangeListener extends PhoneStateListener {
static final int IDLE = 0;
static final int OFFHOOK = 1;
static final int RINGING = 2;
int lastState = IDLE;
@Override
public void onCallStateChanged(int state, String incomingNumber) {
switch(state){
case TelephonyManager.CALL_STATE_RINGING:
lastState = RINGING;
break;
case TelephonyManager.CALL_STATE_OFFHOOK:
lastState = OFFHOOK;
break;
case TelephonyManager.CALL_STATE_IDLE:
if (lastState == RINGING) {
// Process for call hangup without being answered
}
lastState = IDLE;
break;
}
}
}
,查看更多输出,进展顺利以及错误发生的位置,时间和原因。
将这些选项添加到mvn -e -X verify
并再次运行jmeter脚本。希望能够显示一些更多的细节,关于究竟什么时候出错。目前看起来像输出文件不是写的......
jmeter-maven-plugin
提示:使用最新的jmeter-maven-plugin(目前版本为1.10.1)