我使用jmeter-maven-plugin作为maven和jmeter 在jmeter中,我有一些断言失败,但为什么maven项目也标志着成功? 谁来帮帮我。坦克!
这是我的maven项目pom.xml
<build>
<plugins>
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>1.10.1</version>
<executions>
<execution>
<id>jmeter-tests</id>
<phase>verify</phase>
<goals>
<goal>jmeter</goal>
</goals>
<configuration>
<overrideRootLogLevel>debug</overrideRootLogLevel>
<testFilesIncluded>
<jMeterTestFile>${includedTestFiles}</jMeterTestFile>
</testFilesIncluded>
<testFilesExcluded>
<excludeJMeterTestFile>${excluedTestFiles}</excludeJMeterTestFile>
</testFilesExcluded>
<jmeterPlugins>
<plugin>
<groupId>kg.apc</groupId>
<artifactId>jmeter-plugins-standard</artifactId>
</plugin>
</jmeterPlugins>
<propertiesJMeter>
<dateQueryValueS>${dateQueryValueS}</dateQueryValueS>>
</propertiesJMeter>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>kg.apc</groupId>
<artifactId>jmeter-plugins-standard</artifactId>
<version>1.3.1</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
这是构建
mvn verify -DincludedTestFiles = * unshipOrder.jmx -DexcluedTestFiles = noneOfExclued -DdateQueryValueS =&#34; 2016-04-28 09:09:53&#34;
[INFO]
[INFO] -------------------------------------------------------
[INFO] P E R F O R M A N C E T E S T S
[INFO] -------------------------------------------------------
[INFO]
[INFO]
[info]
[debug] JMeter is called with the following command line arguments: -n -t E:\study\jmeter\src\test\jmeter\xbn-online-unshipOrder.jmx -l E:\study\jmeter\target\jmeter\results\20160513-xbn-online-unshipOrder.jtl -d E:\study\jmeter\target\jmeter -L DEBUG -j E:\study\jmeter\target\jmeter\logs\xbn-online-unshipOrder.jmx.log
[info] Executing test: xbn-online-unshipOrder.jmx
[debug] Creating summariser <summary>
[debug] Created the tree successfully using E:\study\jmeter\src\test\jmeter\xbn-online-unshipOrder.jmx
[debug] Starting the test @ Fri May 13 10:20:31 CST 2016 (1463106031631)
[debug] Waiting for possible shutdown message on port 4445
[debug] summary + 1 in 1s = 1.9/s Avg: 370 Min: 370 Max: 370 Err: 0 (0.00%) Active: 1 Started: 1 Finished: 0
[debug] summary + 1 in 0.1s = 10.4/s Avg: 64 Min: 64 Max: 64 Err: 1 (100.00%) Active: 0 Started: 1 Finished: 1
[debug] summary = 2 in 1s = 3.2/s Avg: 217 Min: 64 Max: 370 Err: 1 (50.00%)
[debug] Tidying up ... @ Fri May 13 10:20:32 CST 2016 (1463106032341)
[debug] ... end of run
[info] Completed Test: xbn-online-unshipOrder.jmx
[INFO]
[INFO] Test Results:
[INFO]
[INFO] Tests Run: 1, Failures: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.629 s
[INFO] Finished at: 2016-05-13T10:20:32+08:00
[INFO] Final Memory: 22M/223M
[INFO] ------------------------------------------------------------------------
答案 0 :(得分:1)
我认为这是Maven的工作方式。
下面: Maven在其生命周期中执行项目。在执行此操作时,它会执行pom.xml中定义/配置的插件(有效POM上的所有内容(以eclipse术语表示))。
所以这里“jmeter-maven-plugin”是在这个过程中执行的一个执行器。该插件完成其工作并提供结果。
maven也使用SUCCESS note完成了它的工作。因为从Mavens角度构建成功。
(如果运行JUnit / TestNG测试套件,这将类似) 在这里,我们可以找到一种方法(工具)以可呈现的方式解释生成的结果。
尝试以下:
答案 1 :(得分:0)
实际上默认情况下它应该是失败的,如果没有看到您的测试计划和日志文件,很难说出错了什么。正在使用什么断言以及如何配置?
与此同时,您可以尝试通过将以下行添加到<configuration>
部分来解决此问题:
<ignoreResultFailures>false</ignoreResultFailures>
参考文献:
答案 2 :(得分:0)
您需要将此配置添加到<configuration>
标记内的POM文件中
<scanResultsForFailedRequests>true</scanResultsForFailedRequests>
<ignoreResultFailures>false</ignoreResultFailures>
同时尝试从<configuration>
代码
<executions>
代码
最后执行块看起来应该是这样的
<executions>
<execution>
<id>configure</id>
<goals>
<goal>configure</goal>
</goals>
</execution>
<execution>
<id>performance test</id>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
<execution>
<id>verify</id>
<goals>
<goal>results</goal>
</goals>
</execution>
</executions>
答案 3 :(得分:0)
如果你使用2.6.0版的插件或鞋面,你只需要设置:
<executions>
<execution>
<id>performance test</id>
<goals><goal>jmeter</goal></goals>
</execution>
<execution>
<id>verify</id>
<goals><goal>results</goal></goals>
</execution>
</executions>