即使生成输出,Jmeter maven 照明插件构建失败

标签 jmeter jmeter-4.0

我正在尝试使用 jmeter maven 照明插件进行自动报告分析,但是构建失败。 Lighting启用 CI/CD 与 jmeter 的集成。

我能够设置照明演示项目,但是当我为我的项目设置它时,它会导致构建失败。错误如下:

              [ERROR] Failed to execute goal uk.co.automatictester:jmeter- 
              lightning-maven-plugin:1.2.0:lightning (default) on project 
              jmeter-lightning-maven-plugin-example: MojoExecutionException 
             -> [Help 1]

然而,控制台日志的检查表明已应用规则并生成输出,但它返回的结果基于 lighting.xml 配置文件中指定的标准。

   [DEBUG]   (f) jmeterCsv = 
   C:\Projects\lightingMaven\target\jmeter\results\TestPerformance.csv
   [DEBUG]   (f) mode = verify
   [DEBUG]   (f) testSetXml = 
   C:\Projects\lightingMaven\src\test\resources\lightning.xml
   [DEBUG] -- end configuration --
   [DEBUG] Reading CSV file - start
   [DEBUG] Reading CSV file - finish, read 1602 rows, took 63ms
   [INFO] Test name:            Test #1
   [INFO] Test type:            avgRespTimeTest
   [INFO] Test description:     Verify maximum response times
   [INFO] Transaction name:     getPursesRequest
   [INFO] Expected result:      Average response time <= 2000
   [INFO] Actual result:        Average response time = 1742
   [INFO] Transaction count:    600
   [INFO] Longest transactions: [24095, 23707, 22891, 18723, 16717]
   [INFO] Test result:          Pass
   [INFO] 
   [INFO] Test name:            Test #5
   [INFO] Test type:            passedTransactionsTest
   [INFO] Test description:     Verify number of passed tests
   [INFO] Transaction name:     getPursesRequest
   [INFO] Expected result:      Percent of failed transactions <= 50
   [INFO] Actual result:        Percent of failed transactions = 1
   [INFO] Transaction count:    600
   [INFO] Test result:          Pass
   [INFO] 
   [INFO] Test name:            Test #4
   [INFO] Test type:            nthPercRespTimeTest
   [INFO] Test description:     Verify 90th percentile
   [INFO] Transaction name:     getPursesRequest
   [INFO] Expected result:      90th percentile of transactions have 
    response time <= 8000
   [INFO] Actual result:        90th percentile of transactions have 
    response time = 2218
   [INFO] Transaction count:    600
   [INFO] Longest transactions: [24095, 23707, 22891, 18723, 16717]
   [INFO] Test result:          Pass
   [INFO] 
   [INFO] Test name:            Test #3
   [INFO] Test type:            throughputTest
   [INFO] Test description:     Verify throughput
   [INFO] Transaction name:     getPursesRequest
   [INFO] Expected result:      Throughput >= 0.1 / second
   [INFO] Actual result:        Throughput = 2 / second
   [INFO] Transaction count:    600
   [ INFO] Test result:          Pass
   [INFO] 
   [INFO] Test name:            Test #2
   [INFO] Test type:            maxRespTimeTest
   [INFO] Test description:     Verify maximum resp times
   [INFO] Transaction name:     getPursesRequest
   [INFO] Expected result:      Max response time <= 10000
   [INFO] Actual result:        Max response time = 24095
   [INFO] Transaction count:    600
   [INFO] Longest transactions: [24095, 23707, 22891, 18723, 16717]
   [INFO] Test result:          FAIL
   [INFO] 
   [INFO] ============= EXECUTION SUMMARY =============
   [INFO] Tests executed:    5
   [INFO] Tests passed:      4
   [INFO] Tests failed:      1
   [INFO] Tests errors:      0
   [INFO] Test set status:   FAIL
   [INFO] Execution time:    373ms
   [INFO] ##teamcity[buildStatisticValue key='Test #1' value='1742']
   [INFO] ##teamcity[buildStatisticValue key='Test #5' value='1']
   [INFO] ##teamcity[buildStatisticValue key='Test #4' value='2218']
   [INFO] ##teamcity[buildStatisticValue key='Test #3' value='2']
   [INFO] ##teamcity[buildStatisticValue key='Test #2' value='24095']
   [INFO] ------------------------------------------------------------------
  [INFO] BUILD FAILURE
  [INFO] -------------------------------------------------------------------
  [INFO] Total time: 05:21 min
  [INFO] Finished at: 2018-06-03T16:27:18+01:00

  [INFO] Final Memory: 18M/190M
  [INFO] -------------------------------------------------------------------

光照xml配置文件如下:

<testSet>

<avgRespTimeTest>
    <testName>Test #1</testName>
    <description>Verify maximum response times</description>
    <transactionName>getPursesRequest</transactionName>
    <maxAvgRespTime>2000</maxAvgRespTime>
  </avgRespTimeTest>

 <maxRespTimeTest>
    <testName>Test #2</testName>
    <description>Verify maximum resp times</description>
    <transactionName>getPursesRequest</transactionName>
    <regexp/>
    <maxAllowedRespTime>10000</maxAllowedRespTime>
 </maxRespTimeTest>


 <throughputTest>
    <testName>Test #3</testName>
    <description>Verify throughput</description>
    <transactionName>getPursesRequest</transactionName>
    <regexp/>
    <minThroughput>0.1</minThroughput>
 </throughputTest>

 <nthPercRespTimeTest>
    <testName>Test #4</testName>
    <description>Verify 90th percentile</description>
    <transactionName>getPursesRequest</transactionName>
    <regexp/>
    <percentile>90</percentile>
    <maxRespTime>8000</maxRespTime>
 </nthPercRespTimeTest>

 <passedTransactionsTest>
    <testName>Test #5</testName>
    <description>Verify number of passed tests</description>
    <transactionName>getPursesRequest</transactionName>
    <regexp/>

 <allowedPercentOfFailedTransactions>50</allowedPercentOfFailedTransactions>
 </passedTransactionsTest>
  </testSet>

最佳答案

根据日志,您的响应时间高于 10 秒:

[INFO] Test description: Verify maximum resp times

Expected result: Max response time <= 10000

[INFO] Actual result: Max response time = 24095

[INFO] Test result: FAIL

如果最多 30 秒没问题,请更改最大响应时间

 <maxRespTimeTest>
    <testName>Test #2</testName>
    <description>Verify maximum resp times</description>
    <transactionName>getPursesRequest</transactionName>
    <regexp/>
    <maxAllowedRespTime>30000</maxAllowedRespTime>
 </maxRespTimeTest>

如果看不到如何减少 API 的时间

关于即使生成输出,Jmeter maven 照明插件构建失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50668411/

相关文章:

windows - 为什么 Jmeter 在后台打开控制台(命令提示符)?

java - jmeter中的堆设置程序

linux - 如何从docker文件中获取环境变量

java - JDBC 请求是否与插入查询类型一起使用?

JMeter 中的 TCP 采样器

maven - "Build step ' 调用顶级 Maven 目标 ' marked build as failure"错误

performance - JMeter 是否最终以前端作为入口点测试 Web 应用程序的后端?

jmeter - NET::ERR_CERT_AUTHORITY_INVALID 使用 Apache JMeter 作为代理的 Chrome 66 错误

java - Jmeter - OpenJDK : java. lang.module.FindException : Module java. 未找到激活

JMeter - 某些函数无法在 Function Helper 中执行