Skip to content

Commit

Permalink
Change version 1.4 add export result in html, csv or json format
Browse files Browse the repository at this point in the history
  • Loading branch information
DABURON Vincent committed Jun 14, 2023
1 parent 96141ad commit 1fe5fd6
Show file tree
Hide file tree
Showing 14 changed files with 501 additions and 77 deletions.
48 changes: 35 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Generating JUnit Report based on custom Key Performance Indicators (KPIs) applied to the JMeter Report CSV file

This tool read KPI declarations in a file and apply the KPI assertion on a JMeter Report CSV file and generates a result file in JUnit XML format.
This tool read KPI declarations in a file and apply the KPI assertion on a JMeter Report CSV file 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 @@ -50,19 +50,27 @@ Save in UTF-8 comma separator **no BOM** or csv with comma separator if you have
## Parameters
The tool have parameters :
<pre>
usage: io.github.vdaburon.jmeter.utils.reportkpi.JUnitReportFromJMReportCsv -csvJMReport &lt;csvJMReport&gt; [-csvLabelColumnName &lt;csvLabelColumnName&gt;]
[-exitReturnOnFail &lt;exitReturnOnFail&gt;] [-help] [-junitFile &lt;junitFile&gt;] -kpiFile &lt;kpiFile&gt;
usage: io.github.vdaburon.jmeter.utils.reportkpi.JUnitReportFromJMReportCsv -csvJMReport &lt;csvJMReport&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.reportkpi.JUnitReportFromJMReportCsv
-csvJMReport &lt;csvJMReport&gt; JMeter report csv file (E.g : summary.csv or aggregate.csv or synthesis.csv)
-csvLabelColumnName &lt;csvLabelColumnName&gt; Label Column Name in CSV JMeter Report (Default : Label)
-exitReturnOnFail &lt;exitReturnOnFail&gt; if true then when kpi fail then create JUnit XML file and program return exit 1 (KO); if false
-csvJMReport &lt;csvJMReport&gt; JMeter report csv file (E.g: summary.csv or aggregate.csv or synthesis.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-jmreport.xml)
-kpiFile &lt;kpiFile&gt; KPI file contains rule to check (E.g : kpi.csv)
E.g : java -jar junit-reporter-kpi-from-jmeter-report-csv-&lt;version&gt;-jar-with-dependencies.jar -csvJMReport summary.csv -kpiFile kpi.csv -exitReturnOnFail true
or more parameters : java -jar junit-reporter-kpi-from-jmeter-report-csv-&lt;version&gt;-jar-with-dependencies.jar -csvJMReport AggregateReport.csv -csvLabelColumnName Label
-kpiFile kpi_check.csv -junitFile junit.xml -exitReturnOnFail true
-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 XML file name out (Always created, default: TEST-jmeter-junit-plugin-jmreport.xml)
-kpiFile &lt;kpiFile&gt; KPI file contains rule to check (E.g: kpi.csv)
E.g : java -jar junit-reporter-kpi-from-jmeter-report-csv-&lt;version&gt;-jar-with-dependencies.jar -csvJMReport summary.csv -kpiFile kpi.csv
-exitReturnOnFail true
or more parameters : java -jar junit-reporter-kpi-from-jmeter-report-csv-&lt;version&gt;-jar-with-dependencies.jar -csvJMReport
AggregateReport.csv -csvLabelColumnName Label -kpiFile kpi_check.csv -junitFile junit.xml -htmlOutFile result.html -divHtmlOutFile
div_result.html -csvOutFile result.csv -jsonOutFile result.json -exitReturnOnFail false
</pre>

## JUnit Report XML file generated
Expand Down Expand Up @@ -95,6 +103,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 @@ -104,7 +124,7 @@ The maven groupId, artifactId and version, this plugin is in the **Maven Central
```xml
<groupId>io.github.vdaburon</groupId>
<artifactId>junit-reporter-kpi-from-jmeter-report-csv</artifactId>
<version>1.3</version>
<version>1.4</version>
```
Just include the plugin in your `pom.xml` and execute `mvn verify` <br>
or individual launch `mvn -DjmeterReportFile=synthesis.csv -DkpiFile=kpi.csv -DjunitFile=jmeter-junit-plugin-jmreport.xml exec:java@create_junit-report-kpi-from-jmeter-report`
Expand All @@ -122,7 +142,7 @@ or individual launch `mvn -DjmeterReportFile=synthesis.csv -DkpiFile=kpi.csv -Dj
<dependency>
<groupId>io.github.vdaburon</groupId>
<artifactId>junit-reporter-kpi-from-jmeter-report-csv</artifactId>
<version>1.3</version>
<version>1.4</version>
</dependency>
</dependencies>

Expand Down Expand Up @@ -170,6 +190,8 @@ java -jar junit-reporter-kpi-from-jmeter-report-csv-&lt;version&gt;-jar-with-dep
Usually this plugin is use with [jmeter-graph-tool-maven-plugin](https://github.com/vdaburon/jmeter-graph-tool-maven-plugin)

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

Version 1.3 change Fail Message when Equality

Version 1.2 change package name (add reportkpi)
Expand Down
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.
28 changes: 23 additions & 5 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-from-jmeter-report-csv</artifactId>
<version>1.3</version>
<version>1.4</version>
<packaging>jar</packaging>
<name>Create a JUnit XML file with KPI rules from JMeter CSV Report</name>
<description>A tool that creates a JUnit XML file with KPI rules from JMeter CSV Report</description>
<description>A tool that creates a JUnit XML file with KPI rules from JMeter CSV Report, export result in html, csv or json format</description>
<url>https://github.com/vdaburon/JUnitReportKpiJMeterReportCsv</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
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ public boolean isKpiFail() {
return 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,63 @@
package io.github.vdaburon.jmeter.utils.reportkpi;

import java.util.List;

public class GlobalResult {
private String csvJmeterReport;
private String kpiFile;
private int numberOfKpis;
private int numberFailed;
List checkKpiResults;

public String getCsvJmeterReport() {
return csvJmeterReport;
}

public void setCsvJmeterReport(String csvJmeterReport) {
this.csvJmeterReport = csvJmeterReport;
}

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 getCheckKpiResults() {
return checkKpiResults;
}

public void setCheckKpiResults(List checkKpiResults) {
this.checkKpiResults = checkKpiResults;
}

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

0 comments on commit 1fe5fd6

Please sign in to comment.