TeamCity 结果与 JMeter 的结果不匹配
TeamCity results don't match JMeter's
我目前正在使用 JMeter 对某些应用程序进行负载测试,我使用了持续时间断言并将其设置为,比方说 200,当加载时间超过 200 时,结果树中的请求变为红色,因为它是一个错误。
问题是,当我 运行 与 TeamCity 进行相同的测试时,它总是被标记为 success, even if all the Requests have failed。
您看到的是摘要。
您需要向项目添加一个侦听器,将结果保存到文件中。
然后您需要让 Teamcity 读取该文件并断言结果。
Teamcity 只是告诉你 "Ehhhhh the script you wanted me to run worked"。
这里有一个关于如何操作的小指南:
https://devblog.xero.com/run-jmeter-performance-tests-on-teamcity-8315f7ccffc1#.8ga4jso7k
您并没有真正指定很多信息。你是如何运行申请的?您有可用的 TeamCity JMeter 插件吗?
我运行一个maven项目用jmeter-maven-plugin and teamcity with the JMeter-plugin。现在您可以在 pom.xml 中指定是否希望测试在测试失败时失败:
<ignoreResultFailures>false</ignoreResultFailures>
另请阅读有关 TeamCity 插件的信息,因为它使用特定的(非标准)jtl 格式:
<propertiesJMeter>
<jmeter.save.saveservice.default_delimiter>\t</jmeter.save.saveservice.default_delimiter>
<jmeter.save.saveservice.print_field_names>true</jmeter.save.saveservice.print_field_names>
</propertiesJMeter>
有关详细信息,请参阅此页面,其中解释了 TeamCity JMeter 插件的配置:https://www.blazemeter.com/blog/how-run-jmeter-tests-teamcity-continuous-integration
作为奖励:我花了一些时间来了解如何将参数从 Maven 构建传递给 JMeter 脚本。我得出的结论是 Maven 插件不支持普通的 -J JMeter 参数,您应该改用 -D:
<jMeterProcessJVMSettings>
<arguments>
<argument>-Dimage_path=${teamcity.build.workingDir}/src/test/resources/images</argument>
<argument>-Denvironment=TEST</argument>
</arguments>
</jMeterProcessJVMSettings>
现在在 JMeter 中,您可以使用以下变量值来获取 pom.xml 中指定的值:
${__groovy(System.getProperty("image_path"\,"/some/default/dir"))}
查看 Team City 项目中构建功能下的性能指标计算。您需要确保检查断言,以使构建在断言时失败。
除此之外,较新版本的 JMeter 和 Team City 向输出的 .jtl 文件添加了更多列,因此您需要确保 "success" 列位于文件。我在 TeamCity JMeter 插件 git 回购中遇到这个 post 后发现了这一点:https://github.com/jtorgan/jmeter_plugin/issues/24#issuecomment-421016226
我没有创建脚本,只是确保删除了 TeamCity 服务器上 JMeter user.properties 设置中的一些列,以确保成功列位于第 5 位。
以下是我必须在 user.properties 下为 JMeter 关闭的列:
jmeter.save.saveservice.response_message=false
jmeter.save.saveservice.thread_name=false
jmeter.save.saveservice.data_type=false
我目前正在使用 JMeter 对某些应用程序进行负载测试,我使用了持续时间断言并将其设置为,比方说 200,当加载时间超过 200 时,结果树中的请求变为红色,因为它是一个错误。
问题是,当我 运行 与 TeamCity 进行相同的测试时,它总是被标记为 success, even if all the Requests have failed。
您看到的是摘要。 您需要向项目添加一个侦听器,将结果保存到文件中。 然后您需要让 Teamcity 读取该文件并断言结果。
Teamcity 只是告诉你 "Ehhhhh the script you wanted me to run worked"。
这里有一个关于如何操作的小指南: https://devblog.xero.com/run-jmeter-performance-tests-on-teamcity-8315f7ccffc1#.8ga4jso7k
您并没有真正指定很多信息。你是如何运行申请的?您有可用的 TeamCity JMeter 插件吗?
我运行一个maven项目用jmeter-maven-plugin and teamcity with the JMeter-plugin。现在您可以在 pom.xml 中指定是否希望测试在测试失败时失败:
<ignoreResultFailures>false</ignoreResultFailures>
另请阅读有关 TeamCity 插件的信息,因为它使用特定的(非标准)jtl 格式:
<propertiesJMeter>
<jmeter.save.saveservice.default_delimiter>\t</jmeter.save.saveservice.default_delimiter>
<jmeter.save.saveservice.print_field_names>true</jmeter.save.saveservice.print_field_names>
</propertiesJMeter>
有关详细信息,请参阅此页面,其中解释了 TeamCity JMeter 插件的配置:https://www.blazemeter.com/blog/how-run-jmeter-tests-teamcity-continuous-integration
作为奖励:我花了一些时间来了解如何将参数从 Maven 构建传递给 JMeter 脚本。我得出的结论是 Maven 插件不支持普通的 -J JMeter 参数,您应该改用 -D:
<jMeterProcessJVMSettings>
<arguments>
<argument>-Dimage_path=${teamcity.build.workingDir}/src/test/resources/images</argument>
<argument>-Denvironment=TEST</argument>
</arguments>
</jMeterProcessJVMSettings>
现在在 JMeter 中,您可以使用以下变量值来获取 pom.xml 中指定的值:
${__groovy(System.getProperty("image_path"\,"/some/default/dir"))}
查看 Team City 项目中构建功能下的性能指标计算。您需要确保检查断言,以使构建在断言时失败。
除此之外,较新版本的 JMeter 和 Team City 向输出的 .jtl 文件添加了更多列,因此您需要确保 "success" 列位于文件。我在 TeamCity JMeter 插件 git 回购中遇到这个 post 后发现了这一点:https://github.com/jtorgan/jmeter_plugin/issues/24#issuecomment-421016226
我没有创建脚本,只是确保删除了 TeamCity 服务器上 JMeter user.properties 设置中的一些列,以确保成功列位于第 5 位。
以下是我必须在 user.properties 下为 JMeter 关闭的列:
jmeter.save.saveservice.response_message=false
jmeter.save.saveservice.thread_name=false
jmeter.save.saveservice.data_type=false