Skip to content

Commit

Permalink
Change version 1.1 add export result in html, csv or json format, add…
Browse files Browse the repository at this point in the history
… template html freemarker file
  • Loading branch information
DABURON Vincent committed Jul 6, 2023
1 parent fa79fba commit 21a0fc0
Show file tree
Hide file tree
Showing 14 changed files with 490 additions and 30 deletions.
34 changes: 27 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Compare 2 load tests JMeter Report CSV File and create a JUnit Report based on custom Key Performance Indicators (KPIs)

This tool read KPI declarations in a file and apply the KPI assertion on 2 JMeter Report CSV files (current and reference) and generates a result file in JUnit XML format.
This tool read KPI declarations in a file and apply the KPI assertion on 2 JMeter Report CSV files (current and reference) and generates a result file in JUnit XML format and others formats Html, Json and Csv.

JMeter Report CSV file is created with Listener :
- Summary Report, documentation at [Summary Report](https://jmeter.apache.org/usermanual/component_reference.html#Summary_Report)
Expand Down Expand Up @@ -67,23 +67,29 @@ Save in UTF-8 comma separator **no BOM** or csv with comma separator if you have
The tool have parameters :
<pre>
usage: io.github.vdaburon.jmeter.utils.comparekpi.JUnitReportCompareJMReportCsv -csvJMReportCurrent &lt;csvJMReportCurrent&gt;
-csvJMReportReference &lt;csvJMReportReference&gt; [-csvLabelColumnName &lt;csvLabelColumnName&gt;] [-exitReturnOnFail &lt;exitReturnOnFail&gt;]
[-help] [-junitFile &lt;junitFile&gt;] -kpiFile &lt;kpiFile&gt;
-csvJMReportReference &lt;csvJMReportReference&gt; [-csvLabelColumnName &lt;csvLabelColumnName&gt;] [-csvOutFile &lt;csvOutFile&gt;] [-divHtmlOutFile
&lt;divHtmlOutFile&gt;] [-exitReturnOnFail &lt;exitReturnOnFail&gt;] [-help] [-htmlOutFile &lt;htmlOutFile&gt;] [-jsonOutFile &lt;jsonOutFile&gt;]
[-junitFile &lt;junitFile&gt;] -kpiFile &lt;kpiFile&gt;
io.github.vdaburon.jmeter.utils.comparekpi.JUnitReportCompareJMReportCsv
-csvJMReportCurrent &lt;csvJMReportCurrent&gt; JMeter report current csv file (E.g : summary.csv or aggregate.csv or synthesis.csv)
-csvJMReportReference &lt;csvJMReportReference&gt; JMeter report reference csv file (E.g : summary_ref.csv or aggregate_ref.csv or
synthesis_ref.csv)
-csvLabelColumnName &lt;csvLabelColumnName&gt; Label Column Name in CSV JMeter Report (Default : Label)
-csvOutFile &lt;csvOutFile&gt; Csv out file result optional (E.g: result.csv)
-divHtmlOutFile &lt;divHtmlOutFile&gt; Div Partial Html Page out file result optional (E.g: div_result.html), to include in an
another HTML Page
-exitReturnOnFail &lt;exitReturnOnFail&gt; if true then when kpi fail then create JUnit XML file and program return exit 1 (KO); if
false (Default) then create JUnit XML File and exit 0 (OK)
-help Help and show parameters
-junitFile &lt;junitFile&gt; junit file name out (Default : jmeter-junit-plugin-compare-jmreport.xml)
-htmlOutFile &lt;htmlOutFile&gt; Html out file result optional (E.g: result.html)
-jsonOutFile &lt;jsonOutFile&gt; Json out file result optional (E.g: result.json)
-junitFile &lt;junitFile&gt; junit file name out (Default : TEST-jmeter-junit-plugin-compare-jmreport.xml)
-kpiFile &lt;kpiFile&gt; KPI file contains rule to check and compare to reference value (E.g : kpi_compare.csv)
E.g : java -jar junit-reporter-kpi-compare-jmeter-report-csv-&lt;version&gt;-jar-with-dependencies.jar -csvJMReportCurrent summary.csv
-csvJMReportReference summary_ref.csv -kpiFile kpi_compare.csv -exitReturnOnFail true
or more parameters : java -jar junit-reporter-kpi-compare-jmeter-report-csv-&lt;version&gt;-jar-with-dependencies.jar -csvJMReportCurrent
aggreagate.csv -csvJMReportReference aggregate_ref.csv -csvLabelColumnName Label -kpiFile kpi_compare.csv -junitFile junit_compare.xml
-exitReturnOnFail true
-htmlOutFile result.html -divHtmlOutFile div_result.html -csvOutFile result.csv -jsonOutFile result.json -exitReturnOnFail true
</pre>

## JUnit Report XML file generated
Expand Down Expand Up @@ -128,6 +134,18 @@ A JUnit Report with KPIs display in Jenkins Build<br>
If you click on link "Name Test" fail , you will show the fail message<br>
![junit jenkins build detail fail](doc/images/junit_report_jenkins_detail_fail.png)

## Html out format
The result could be a html page ou partial html page (div)
![html out format](doc/images/html_out_result.png)

## Csv out format
The result in a csv file
![csv out format](doc/images/csv_out_result.png)

## Json out format
The result in a Json file
![csv out format](doc/images/json_out_result.png)

## License
See the LICENSE file Apache 2 [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0)

Expand All @@ -137,7 +155,7 @@ The maven groupId, artifactId and version, this plugin is in the **Maven Central
```xml
<groupId>io.github.vdaburon</groupId>
<artifactId>junit-reporter-kpi-compare-jmeter-report-csv</artifactId>
<version>1.0</version>
<version>1.1</version>
```
Just include the plugin in your `pom.xml` and execute `mvn verify` <br>
or individual launch `mvn -jmeterReportCurrent=synthesis.csv -DjmeterReportReference=synthesis_ref.csv -DkpiFile=kpi.csv -DjunitFile=TEST-jmeter-junit-plugin-compare-jmreport.xml exec:java@create_junit-reporter-kpi-compare-jmeter-report`
Expand All @@ -156,7 +174,7 @@ or individual launch `mvn -jmeterReportCurrent=synthesis.csv -DjmeterReportRefer
<dependency>
<groupId>io.github.vdaburon</groupId>
<artifactId>junit-reporter-kpi-compare-jmeter-report-csv</artifactId>
<version>1.0</version>
<version>1.1</version>
</dependency>
</dependencies>

Expand Down Expand Up @@ -207,5 +225,7 @@ java -jar junit-reporter-kpi-compare-jmeter-report-csv-&lt;version&gt;-jar-with-
Usually this plugin is use with [jmeter-graph-tool-maven-plugin](https://github.com/vdaburon/jmeter-graph-tool-maven-plugin)

## Versions
version 1.1 export result in html, json or csv format

Version 1.0 initial version

Binary file added doc/images/csv_out_result.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/html_out_result.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/json_out_result.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 28 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

<groupId>io.github.vdaburon</groupId>
<artifactId>junit-reporter-kpi-compare-jmeter-report-csv</artifactId>
<version>1.0</version>
<version>1.1</version>
<packaging>jar</packaging>
<name>Create a JUnit XML file with KPI rules and compare 2 JMeter CSV Report (current and reference)</name>
<description>Read KPI declarations in a file and apply the KPI assertion on 2 JMeter Report CSV files (current and reference) and generates a result file in JUnit XML format.</description>
<description>Read KPI declarations in a file and apply the KPI assertion on 2 JMeter Report CSV files (current and reference) and generates a result file in JUnit XML format and other formats : html, csv and json.</description>
<url>https://github.com/vdaburon/JUnitReportKpiCompareJMeterReportCsv</url>
<inceptionYear>2023</inceptionYear>

Expand Down Expand Up @@ -64,16 +64,34 @@
</properties>

<dependencies>
<!-- Command Line Parameters -->
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>1.5.0</version>
</dependency>

<!-- Read or write CSV file -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-csv</artifactId>
<version>1.10.0</version>
</dependency>

<!-- HTML out file result -->
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.32</version>
</dependency>

<!-- JSON out file result -->
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>1.5.0</version>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.15.2</version>
</dependency>

</dependencies>

<build>
Expand Down Expand Up @@ -155,14 +173,18 @@
</executions>
</plugin>
<plugin>
<!-- deploy jar in maven central or stagging only : mvn clean deploy
if autoReleaseAfterClose == true then release in maven central;
if autoReleaseAfterClose == false then release in stagging only not maven central
-->
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.13</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>false</autoReleaseAfterClose>
<autoReleaseAfterClose>false </autoReleaseAfterClose>
</configuration>
</plugin>
</plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* Classe to save the comparaison parameters for a KPI and the result
*/
public class checkKpiCompareResult {
public class CheckKpiCompareResult {
private String nameKpi;
private String metricCsvColumnName;
private String labelRegex;
Expand Down Expand Up @@ -74,6 +74,11 @@ public boolean isKpiFail() {
return isKpiFail;
}

// ajout pour freemaker qui fait un get (getKpiFail) et pas un is (isKpiFail)
public boolean getKpiFail() {
return isKpiFail;
}

public void setKpiFail(boolean kpiFail) {
isKpiFail = kpiFail;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
package io.github.vdaburon.jmeter.utils.comparekpi;

import java.util.List;

public class GlobalResult {
private String csvJmeterCurrentReport;
private String csvJmeterReferenceReport;
private String kpiFile;
private int numberOfKpis;
private int numberFailed;
List checkKpiCompareResults;

public String getCsvJmeterCurrentReport() {
return csvJmeterCurrentReport;
}

public void setCsvJmeterCurrentReport(String csvJmeterCurrentReport) {
this.csvJmeterCurrentReport = csvJmeterCurrentReport;
}

public String getCsvJmeterReferenceReport() {
return csvJmeterReferenceReport;
}

public void setCsvJmeterReferenceReport(String csvJmeterReferenceReport) {
this.csvJmeterReferenceReport = csvJmeterReferenceReport;
}

public String getKpiFile() {
return kpiFile;
}

public void setKpiFile(String kpiFile) {
this.kpiFile = kpiFile;
}

public int getNumberOfKpis() {
return numberOfKpis;
}

public void setNumberOfKpis(int numberOfKpis) {
this.numberOfKpis = numberOfKpis;
}

public int getNumberFailed() {
return numberFailed;
}

public void setNumberFailed(int numberFailed) {
this.numberFailed = numberFailed;
}

public List getCheckKpiCompareResults() {
return checkKpiCompareResults;
}

public void setCheckKpiCompareResults(List checkKpiCompareResults) {
this.checkKpiCompareResults = checkKpiCompareResults;
}

@Override
public String toString() {
final StringBuilder sb = new StringBuilder("GlobalResult{");
sb.append("csvJmeterCurrentReport='").append(csvJmeterCurrentReport).append('\'');
sb.append(", csvJmeterReferenceReport='").append(csvJmeterReferenceReport).append('\'');
sb.append(", kpiFile='").append(kpiFile).append('\'');
sb.append(", numberOfKpis=").append(numberOfKpis);
sb.append(", numberFailed=").append(numberFailed);
sb.append(", checkKpiCompareResults=").append(checkKpiCompareResults);
sb.append('}');
return sb.toString();
}
}
Loading

0 comments on commit 21a0fc0

Please sign in to comment.