SonarQube 5.1 - Apache JMeter 插件 - 发布性能报告数据
SonarQube 5.1 - Apache JMeter Plugin - Publish Performance report data
我有SonarQube 5.1,SonarQube 中安装的JMeter 插件是0.3。
Maven 是:3.1.0
我有一个简单的单级 Maven 项目,其中包含一些测试和 JMeter jmx 文件。
我成功生成了测试结果(单元测试)和 JMeter 结果文件(XML 格式的 .jtl 文件,而不是默认的 CSV 格式)。参考:Sonarqube + Jmeter error in jtl file
项目的 pom.xml 看起来像:
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.company.csa.reference</groupId>
<artifactId>csa-reference-app</artifactId>
<version>0.0.17-SNAPSHOT</version>
</parent>
<properties>
<sonar.host.url>http://sandboxserver12.tsh.thomson.com:9000</sonar.host.url>
<sonar.jdbc.url>jdbc:h2:tcp://sandboxserver12.tsh.thomson.com:9092/sonar</sonar.jdbc.url>
<sonar.jdbc.driverClassName>org.h2.Driver</sonar.jdbc.driverClassName>
<sonar.jdbc.username>sonar</sonar.jdbc.username>
<sonar.jdbc.password>sonar</sonar.jdbc.password>
<sonar.junit.reportsPath>target/surefire-reports</sonar.junit.reportsPath>
<sonar.surefire.reportsPath>target/surefire-reports</sonar.surefire.reportsPath>
<sonar.java.junit.reportsPath>target/surefire-reports</sonar.java.junit.reportsPath>
<sonar.java.surefire.reportsPath>target/surefire-reports</sonar.java.surefire.reportsPath>
<sonar.groovy.junit.reportsPath>target/surefire-reports</sonar.groovy.junit.reportsPath>
<sonar.groovy.surefire.reportsPath>target/surefire-reports</sonar.groovy.surefire.reportsPath>
<sonar.language>java</sonar.language>
<sonar.sources>src/main/java</sonar.sources>
<sonar.tests>src/test/java</sonar.tests>
<sonar.binaries>target/classes</sonar.binaries>
<sonar.java.binaries>target/classes</sonar.java.binaries>
<sonar.groovy.binaries>target/classes</sonar.groovy.binaries>
</properties>
<artifactId>a_test_app</artifactId>
<packaging>war</packaging>
<name>a_test_app Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>8.1.15.v20140411</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<version>8.1.15.v20140411</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>a_test_app</finalName>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>2.7.1</version>
</plugin>
</plugins>
</build>
</project>
当我 运行 mvn sonar:sonar 时,它成功运行但显示以下行:
[INFO] [02:35:54.784] Sensor JMeterSensor
[INFO] [02:35:54.784] Sensor JMeterSensor (done) | time=0ms
..
..
[DEBUG] [02:35:57.410] Post-jobs : org.sonar.plugins.jmeter.JMeterPostJob@79854a9e -> org.sonar.plugins.issueassign.notification.SendIssueNotificationsPostJob@3c848bb2 -> org.sonar.plugins.buildbreaker.AlertBreaker@55faaed1 -> org.sonar.plugins.buildbreaker.ForbiddenConfigurationBreaker@295790db
[INFO] [02:35:57.410] Executing post-job class org.sonar.plugins.jmeter.JMeterPostJob
[DEBUG] [02:35:57.411] START JMeterPostJob
[INFO] [02:35:57.411] Getting JMeter results from /path/home/user/giga/csa/a_test_app/target/jmeter/results/CSARefApp.jtl
[DEBUG] [02:35:57.420] getInputStreamByTestConfig for config 'a_test_app Maven Webapp'
[DEBUG] [02:35:57.420] JTL path: /path/home/user/giga/csa/a_test_app/target/jmeter/results/CSARefApp.jtl
[DEBUG] [02:35:57.423] Creating JtlAbstractSampleReader ...
[INFO] [02:35:57.636] Starting global summary report for config 'testapp Maven Webapp'
[DEBUG] [02:35:58.055] JtlAbstractSampleReader read 240 nodes
[INFO] [02:35:58.055] Global summary report successful finished for config 'testapp Maven Webapp'
[DEBUG] [02:35:58.062] JMeter GlobalSummary:
mostUnstableTransBytesOkAvgDevPercent=0.0
mostUnstableTransName=null
mostUnstableTransResponseTimeOkAvgDevPercent=0.0
requestsBytesOkAvg=17003.4375
requestsBytesOkAvgDev=41125.73795246031
requestsBytesOkAvgDevPercent=241.86719863239603
requestsErrorPercent=0.0
requestsErrorTotal=0
requestsOkPerMinute=2452.7337761880426
requestsOkPerMinuteAndUser=122.63668880940213
requestsOkTotal=160
requestsResponseTimeOkAvg=48.5
requestsResponseTimeOkAvgDev=152.453354037334
requestsResponseTimeOkAvgDevPercent=314.33681244811135
requestsTotal=160
slowestTransBytesOkAvgDevPercent=0.0
slowestTransName=null
...
......
..........
transMapResponseTimeOkAvgDevPercent={Transaction_Welcome=57.41068190712635, Transaction_Snoop=56.1112617700907, Transaction_Healthcheck=139.89028322965896, Transaction_Logout=50.02351333561716}
transOkPerMinute=1226.3668880940213
transOkPerMinuteAndUser=61.318344404701065
transOkTotal=80
transOrder=[Transaction_Healthcheck, Transaction_Snoop, Transaction_Welcome, Transaction_Logout]
transResponseTimeOkAvg=97.0
transResponseTimeOkAvgDev=210.29557258321267
transResponseTimeOkAvgDevPercent=216.79955936413677
transTotal=80
usersLogged=20
[DEBUG] [02:35:58.066] END JMeterPostJob
一切看起来都不错,但我想知道为什么它显示以下行,即使我拥有的 .jtl 文件有效并且 Jenkins Performance 插件报告显示有效 data/graphs.为什么声纳忽略它。我尝试将 JMeter 结果 .jtl 文件放在 target/jmeter/results 和 target/jmeter-reports 文件夹下,但 SonarQube 中的 JMeter 小部件(在项目的仪表板上)不显示如下所示的任何数据。
[INFO] [02:35:54.784] Sensor JMeterSensor (done) | time=0ms
这是因为现在不推荐使用 JMeter 插件吗http://docs.sonarqube.org/display/PLUG/Deprecated+Plugins?
我 在 SonarQube 的 JMeter 插件部分不再看到设置,您可以在我的 SonarQube 中指定 LOCAL jtl 文件版本。
如果我看到这个矩阵,它表明 SonarQube 中的 JMeter 插件版本 0.3 与所有可用的 SonarQube 版本兼容。 查看此处了解 JMeter 兼容性:http://docs.sonarqube.org/display/PLUG/Plugin+Version+Matrix
GitHub 中的声纳插件也是 0.5 版本 https://github.com/SonarCommunity/sonar-jmeter(但根据其兼容性矩阵未在 SonarQube Docs 站点中列出)。
不确定我现在错过了什么。
您是否在 Sonar 项目上配置了 JMeter 属性?
- 确保为 SonarQube 安装了 Jmeter 插件。
- 配置您的项目
提供 .jtl
个文件的路径。
Project > Settings > General Settings > JMeter > Local jtl file
然后在项目 Overview
选项卡中,转到 Configure widgets > Search:
,搜索 JMeter
> Add widget
.
运行 再次使用 Sonar 以查看新结果。
我有SonarQube 5.1,SonarQube 中安装的JMeter 插件是0.3。 Maven 是:3.1.0
我有一个简单的单级 Maven 项目,其中包含一些测试和 JMeter jmx 文件。
我成功生成了测试结果(单元测试)和 JMeter 结果文件(XML 格式的 .jtl 文件,而不是默认的 CSV 格式)。参考:Sonarqube + Jmeter error in jtl file
项目的 pom.xml 看起来像:
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.company.csa.reference</groupId>
<artifactId>csa-reference-app</artifactId>
<version>0.0.17-SNAPSHOT</version>
</parent>
<properties>
<sonar.host.url>http://sandboxserver12.tsh.thomson.com:9000</sonar.host.url>
<sonar.jdbc.url>jdbc:h2:tcp://sandboxserver12.tsh.thomson.com:9092/sonar</sonar.jdbc.url>
<sonar.jdbc.driverClassName>org.h2.Driver</sonar.jdbc.driverClassName>
<sonar.jdbc.username>sonar</sonar.jdbc.username>
<sonar.jdbc.password>sonar</sonar.jdbc.password>
<sonar.junit.reportsPath>target/surefire-reports</sonar.junit.reportsPath>
<sonar.surefire.reportsPath>target/surefire-reports</sonar.surefire.reportsPath>
<sonar.java.junit.reportsPath>target/surefire-reports</sonar.java.junit.reportsPath>
<sonar.java.surefire.reportsPath>target/surefire-reports</sonar.java.surefire.reportsPath>
<sonar.groovy.junit.reportsPath>target/surefire-reports</sonar.groovy.junit.reportsPath>
<sonar.groovy.surefire.reportsPath>target/surefire-reports</sonar.groovy.surefire.reportsPath>
<sonar.language>java</sonar.language>
<sonar.sources>src/main/java</sonar.sources>
<sonar.tests>src/test/java</sonar.tests>
<sonar.binaries>target/classes</sonar.binaries>
<sonar.java.binaries>target/classes</sonar.java.binaries>
<sonar.groovy.binaries>target/classes</sonar.groovy.binaries>
</properties>
<artifactId>a_test_app</artifactId>
<packaging>war</packaging>
<name>a_test_app Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>8.1.15.v20140411</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<version>8.1.15.v20140411</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>a_test_app</finalName>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>2.7.1</version>
</plugin>
</plugins>
</build>
</project>
当我 运行 mvn sonar:sonar 时,它成功运行但显示以下行:
[INFO] [02:35:54.784] Sensor JMeterSensor
[INFO] [02:35:54.784] Sensor JMeterSensor (done) | time=0ms
..
..
[DEBUG] [02:35:57.410] Post-jobs : org.sonar.plugins.jmeter.JMeterPostJob@79854a9e -> org.sonar.plugins.issueassign.notification.SendIssueNotificationsPostJob@3c848bb2 -> org.sonar.plugins.buildbreaker.AlertBreaker@55faaed1 -> org.sonar.plugins.buildbreaker.ForbiddenConfigurationBreaker@295790db
[INFO] [02:35:57.410] Executing post-job class org.sonar.plugins.jmeter.JMeterPostJob
[DEBUG] [02:35:57.411] START JMeterPostJob
[INFO] [02:35:57.411] Getting JMeter results from /path/home/user/giga/csa/a_test_app/target/jmeter/results/CSARefApp.jtl
[DEBUG] [02:35:57.420] getInputStreamByTestConfig for config 'a_test_app Maven Webapp'
[DEBUG] [02:35:57.420] JTL path: /path/home/user/giga/csa/a_test_app/target/jmeter/results/CSARefApp.jtl
[DEBUG] [02:35:57.423] Creating JtlAbstractSampleReader ...
[INFO] [02:35:57.636] Starting global summary report for config 'testapp Maven Webapp'
[DEBUG] [02:35:58.055] JtlAbstractSampleReader read 240 nodes
[INFO] [02:35:58.055] Global summary report successful finished for config 'testapp Maven Webapp'
[DEBUG] [02:35:58.062] JMeter GlobalSummary:
mostUnstableTransBytesOkAvgDevPercent=0.0
mostUnstableTransName=null
mostUnstableTransResponseTimeOkAvgDevPercent=0.0
requestsBytesOkAvg=17003.4375
requestsBytesOkAvgDev=41125.73795246031
requestsBytesOkAvgDevPercent=241.86719863239603
requestsErrorPercent=0.0
requestsErrorTotal=0
requestsOkPerMinute=2452.7337761880426
requestsOkPerMinuteAndUser=122.63668880940213
requestsOkTotal=160
requestsResponseTimeOkAvg=48.5
requestsResponseTimeOkAvgDev=152.453354037334
requestsResponseTimeOkAvgDevPercent=314.33681244811135
requestsTotal=160
slowestTransBytesOkAvgDevPercent=0.0
slowestTransName=null
...
......
..........
transMapResponseTimeOkAvgDevPercent={Transaction_Welcome=57.41068190712635, Transaction_Snoop=56.1112617700907, Transaction_Healthcheck=139.89028322965896, Transaction_Logout=50.02351333561716}
transOkPerMinute=1226.3668880940213
transOkPerMinuteAndUser=61.318344404701065
transOkTotal=80
transOrder=[Transaction_Healthcheck, Transaction_Snoop, Transaction_Welcome, Transaction_Logout]
transResponseTimeOkAvg=97.0
transResponseTimeOkAvgDev=210.29557258321267
transResponseTimeOkAvgDevPercent=216.79955936413677
transTotal=80
usersLogged=20
[DEBUG] [02:35:58.066] END JMeterPostJob
一切看起来都不错,但我想知道为什么它显示以下行,即使我拥有的 .jtl 文件有效并且 Jenkins Performance 插件报告显示有效 data/graphs.为什么声纳忽略它。我尝试将 JMeter 结果 .jtl 文件放在 target/jmeter/results 和 target/jmeter-reports 文件夹下,但 SonarQube 中的 JMeter 小部件(在项目的仪表板上)不显示如下所示的任何数据。
[INFO] [02:35:54.784] Sensor JMeterSensor (done) | time=0ms
这是因为现在不推荐使用 JMeter 插件吗http://docs.sonarqube.org/display/PLUG/Deprecated+Plugins?
我 在 SonarQube 的 JMeter 插件部分不再看到设置,您可以在我的 SonarQube 中指定 LOCAL jtl 文件版本。
如果我看到这个矩阵,它表明 SonarQube 中的 JMeter 插件版本 0.3 与所有可用的 SonarQube 版本兼容。 查看此处了解 JMeter 兼容性:http://docs.sonarqube.org/display/PLUG/Plugin+Version+Matrix
GitHub 中的声纳插件也是 0.5 版本 https://github.com/SonarCommunity/sonar-jmeter(但根据其兼容性矩阵未在 SonarQube Docs 站点中列出)。
不确定我现在错过了什么。
您是否在 Sonar 项目上配置了 JMeter 属性?
- 确保为 SonarQube 安装了 Jmeter 插件。
- 配置您的项目
提供
.jtl
个文件的路径。Project > Settings > General Settings > JMeter > Local jtl file
然后在项目 Overview
选项卡中,转到 Configure widgets > Search:
,搜索 JMeter
> Add widget
.
运行 再次使用 Sonar 以查看新结果。