Skip to content

Commit 7f22c68

Browse files
author
DABURON Vincent
committed
version 1.1 change Fail Message when equality
1 parent 3861ee6 commit 7f22c68

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ The maven groupId, artifactId and version, this plugin is in the **Maven Central
9898
```xml
9999
<groupId>io.github.vdaburon</groupId>
100100
<artifactId>junit-reporter-kpi-from-jmeter-dashboard-stats</artifactId>
101-
<version>1.0</version>
101+
<version>1.1</version>
102102
```
103103
Just include the plugin in your `pom.xml` and execute `mvn verify` <br>
104104
or individual launch `mvn -DjsonStats=statistics.json -DkpiFile=kpi.csv -DjunitFile=jmeter-junit-plugin-jmstats.xml exec:java@create_junit-report-kpi-from-jmeter-json-statics`
@@ -117,7 +117,7 @@ or individual launch `mvn -DjsonStats=statistics.json -DkpiFile=kpi.csv -DjunitF
117117
<dependency>
118118
<groupId>io.github.vdaburon</groupId>
119119
<artifactId>junit-reporter-kpi-from-jmeter-dashboard-stats</artifactId>
120-
<version>1.0</version>
120+
<version>1.1</version>
121121
</dependency>
122122
</dependencies>
123123

@@ -167,5 +167,7 @@ Usually this plugin is use with [jmeter-maven-plugin](https://github.com/jmeter-
167167
You could also use [jmeter-graph-tool-maven-plugin](https://github.com/vdaburon/jmeter-graph-tool-maven-plugin)
168168

169169
## Versions
170+
Version 1.1 change Fail Message when equality
171+
170172
Version 1.0 initial version
171173

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>io.github.vdaburon</groupId>
88
<artifactId>junit-reporter-kpi-from-jmeter-dashboard-stats</artifactId>
9-
<version>1.0</version>
9+
<version>1.1</version>
1010
<packaging>jar</packaging>
1111
<name>Create a JUnit XML file with KPI rules from JMeter Dashboard Stats</name>
1212
<description>A tool that creates a JUnit XML file with KPI rules from JMeter JMeter Dashboard stats.json</description>

src/main/java/io/github/vdaburon/jmeter/utils/jsonkpi/JUnitReportFromJMDashboardStats.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ private static boolean analyseJsonJMReportWithKpiRules(String jsonJmeterStats, S
123123

124124
Document document = UtilsJUnitXml.createJUnitRootDocument();
125125
for (int i = 0; i < csvKpiLines.size(); i++) {
126+
CSVRecord recordKpiLine = csvKpiLines.get(i);
127+
if (recordKpiLine.size() < 3) {
128+
continue;
129+
}
126130
CheckKpiResult checkKpiResult = verifyKpi(csvKpiLines.get(i), listStats);
127131
if (checkKpiResult.isKpiFail()) {
128132
isFail = true;
@@ -218,7 +222,7 @@ private static CheckKpiResult verifyKpi(CSVRecord recordKpiLine, List<Statistic>
218222
isFailKpi = true;
219223
if (isFirstFail) {
220224
isFirstFail = false;
221-
String failMessage = "Actual value " + dMetric + " exceeds threshold " + dThreshold + " for samples matching \"" + labelRegex + "\"; fail label(s) \"" + label + "\""; // Actual value 2908,480000 exceeds threshold 2500,000000 for samples matching "@SC01_P03_DUMMY"
225+
String failMessage = "Actual value " + dMetric + " exceeds or equals threshold " + dThreshold + " for samples matching \"" + labelRegex + "\"; fail label(s) \"" + label + "\""; // Actual value 2908,480000 exceeds threshold 2500,000000 for samples matching "@SC01_P03_DUMMY"
222226
checkKpiResult.setKpiFail(true);
223227
checkKpiResult.setFailMessage(failMessage);
224228
} else {
@@ -241,7 +245,7 @@ private static CheckKpiResult verifyKpi(CSVRecord recordKpiLine, List<Statistic>
241245
isFailKpi = true;
242246
if (isFirstFail) {
243247
isFirstFail = false;
244-
String failMessage = "Actual value " + dMetric + " exceeds or equals threshold " + dThreshold + " for samples matching \"" + labelRegex + "\"; fail label(s) \"" + label + "\"";
248+
String failMessage = "Actual value " + dMetric + " exceeds threshold " + dThreshold + " for samples matching \"" + labelRegex + "\"; fail label(s) \"" + label + "\"";
245249
checkKpiResult.setKpiFail(true);
246250
checkKpiResult.setFailMessage(failMessage);
247251
} else {
@@ -264,7 +268,7 @@ private static CheckKpiResult verifyKpi(CSVRecord recordKpiLine, List<Statistic>
264268
isFailKpi = true;
265269
if (isFirstFail) {
266270
isFirstFail = false;
267-
String failMessage = "Actual value " + dMetric + " is less then threshold " + dThreshold + " for samples matching \"" + labelRegex + "\"; fail label(s) \"" + label + "\"";
271+
String failMessage = "Actual value " + dMetric + " is less or equals then threshold " + dThreshold + " for samples matching \"" + labelRegex + "\"; fail label(s) \"" + label + "\"";
268272
checkKpiResult.setKpiFail(true);
269273
checkKpiResult.setFailMessage(failMessage);
270274
} else {
@@ -287,7 +291,7 @@ private static CheckKpiResult verifyKpi(CSVRecord recordKpiLine, List<Statistic>
287291
isFailKpi = true;
288292
if (isFirstFail) {
289293
isFirstFail = false;
290-
String failMessage = "Actual value " + dMetric + "is less or equals threshold " + dThreshold + " for samples matching \"" + labelRegex + "\"; fail label(s) \"" + label + "\"";
294+
String failMessage = "Actual value " + dMetric + " is less threshold " + dThreshold + " for samples matching \"" + labelRegex + "\"; fail label(s) \"" + label + "\"";
291295
checkKpiResult.setKpiFail(true);
292296
checkKpiResult.setFailMessage(failMessage);
293297
} else {

0 commit comments

Comments
 (0)