Skip to content

Commit b3288f1

Browse files
asimellTattoo
andauthored
Drop support for test criticality (#83)
* Remove criticality support * Keep current behaviour in token macro as default * doc/README.md: clarify plugin versions and RF compatibility --------- Co-authored-by: Tatu Kairi <[email protected]>
1 parent db39ba1 commit b3288f1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+63
-369
lines changed

doc/README.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ Tracker](https://issues.jenkins-ci.org/issues/?jql=project+%3D+JENKINS+AND+compo
6464
persist for viewing later in the logs you must configure them under
6565
"Advanced... -\> Other files to copy". The field accepts comma
6666
separated list of files and supports wildcards `*` and `?`.
67-
9. Set thresholds and optionally disable thresholds for critical tests
68-
only to count every test in the pass percentage.
67+
9. Set thresholds and optionally include thresholds for skipped tests
68+
to count every test in the pass percentage.
6969

7070
### Pipeline configuration
7171

@@ -86,8 +86,6 @@ Tracker](https://issues.jenkins-ci.org/issues/?jql=project+%3D+JENKINS+AND+compo
8686
)
8787
```
8888
89-
**NOTE!** `onlyCritical` parameter has been deprecated and will be removed in the future. It has no effect on the results.
90-
9189
### Configuring direct links to log files
9290
9391
#### Version 1.3.0+
@@ -142,8 +140,9 @@ Prerequisites: token-macro plugin and email-ext plugin installed.
142140
- `${ROBOT_PASSPERCENTAGE, countSkippedTests}` - Expands to pass percentage
143141
of tests. (passed / total \* 100 %).
144142
`countSkippedTests` is an optional parameter that can be used to include skipped tests in the total count. Default value is `false`.
145-
- `${ROBOT_PASSRATIO}` - Expands to build result in 'passed
146-
/ total' format. This total includes skipped test cases.
143+
- `${ROBOT_PASSRATIO, countSkippedTests}` - Expands to build result in 'passed
144+
/ total' format.
145+
`countSkippedTests` is an optional parameter that can be used to include skipped tests in the total count. Default value is `True`.
147146
- `${ROBOT_PASSED}` - Expands to count of passed cases.
148147
- `${ROBOT_REPORTLINK}` - If logfile link is configured in the Robot
149148
plugin this link will point to that file for the build. Else show
@@ -174,12 +173,12 @@ security vulnerabilities**.
174173
175174
## Robot Framework 4.x+ compatibility
176175
177-
:heavy_exclamation_mark: As we're preparing to drop support for RF 3.x, the `onlyCritical` flag has been deprecated and no
178-
longer has any effect. It will be removed in the future, but for now it's available for the transition period.
179176
A new flag `countSkippedTests` has been added to the pipeline step to allow users to choose whether to count skipped
180177
tests in the pass percentage calculation.
181178
182-
The plugin still supports RF 3.x, but no longer takes criticality into account. If you want to use RF 3.x with criticality, please downgrade to the last major version (4.0.0)
179+
## Robot Framework <3.0 compatibility
180+
181+
If you want to use RF 3.x with criticality, please downgrade to the major version 4.0.0. Plugin versions 5.x support RF 3.x as well, but no longer takes criticality into account.
183182
184183
## Overall Screenshots
185184

src/main/java/hudson/plugins/robot/AggregatedRobotAction.java

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,6 @@ public double getOverallPassPercentage() {
6161
return aggregatedResult.getPassPercentage(false);
6262
}
6363

64-
public double getCriticalPassPercentage() {
65-
return aggregatedResult.getPassPercentage(true);
66-
}
67-
6864
public String getIconFileName() {
6965
return "/plugin/robot/robot.png";
7066
}
@@ -100,7 +96,6 @@ public void doGraph(StaplerRequest2 req, StaplerResponse2 rsp)
10096
Boolean.parseBoolean(req.getParameter("zoomSignificant")),
10197
false, Boolean.parseBoolean(req.getParameter("hd")),
10298
Boolean.parseBoolean(req.getParameter("failedOnly")),
103-
Boolean.parseBoolean(req.getParameter("criticalOnly")),
10499
labelFormat,
105100
Integer.parseInt(req.getParameter("maxBuildsToShow")));
106101
g.doPng(req, rsp);
@@ -123,24 +118,6 @@ public void addResult(RobotResult result) {
123118
skipped += result.getOverallSkipped();
124119
}
125120

126-
@Deprecated
127-
@Override
128-
public long getCriticalPassed() {
129-
return this.getOverallPassed();
130-
}
131-
132-
@Deprecated
133-
@Override
134-
public long getCriticalFailed() {
135-
return this.getOverallFailed();
136-
}
137-
138-
@Deprecated
139-
@Override
140-
public long getCriticalTotal() {
141-
return this.getOverallTotal();
142-
}
143-
144121
@Override
145122
public long getOverallPassed(){
146123
return passed;

src/main/java/hudson/plugins/robot/RobotBuildAction.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,10 @@ public double getOverallPassPercentage(){
200200
}
201201

202202
/**
203-
* Get ratio of passed tests per total tests. Accounts for only critical tests run.
203+
* Get ratio of passed tests per total tests. Accounts for all tests run and skipped.
204204
* @return percent number
205205
*/
206-
public double getCriticalPassPercentage() {
206+
public double getPassPercentageWithSkipped() {
207207
return getResult().getPassPercentage(true);
208208
}
209209

@@ -282,7 +282,6 @@ public void doGraph(StaplerRequest2 req, StaplerResponse2 rsp)
282282
Boolean.parseBoolean(req.getParameter("zoomSignificant")), false,
283283
Boolean.parseBoolean(req.getParameter("hd")),
284284
Boolean.parseBoolean(req.getParameter("failedOnly")),
285-
Boolean.parseBoolean(req.getParameter("criticalOnly")),
286285
labelFormat,
287286
Integer.parseInt(maxBuildsReq));
288287
g.doPng(req, rsp);

src/main/java/hudson/plugins/robot/RobotParser.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,6 @@ private RobotCaseResult processTest(XMLStreamReader reader, RobotSuiteResult res
287287
caseResult.setLogFile(this.logFileName);
288288
//parse attributes
289289
caseResult.setName(reader.getAttributeValue(null, "name"));
290-
//setCriticalityIfAvailable(reader, caseResult);
291290
caseResult.setId(reader.getAttributeValue(null, "id"));
292291
//parse test tags
293292
caseResult.setDescription("");
@@ -340,7 +339,6 @@ private RobotCaseResult processTest(XMLStreamReader reader, RobotSuiteResult res
340339
if (schemaVersion >= 5) {
341340
caseResult.setElapsedTime(reader.getAttributeValue(null, elapsedLocalName));
342341
}
343-
// setCriticalityIfAvailable(reader, caseResult);
344342
while(reader.hasNext()){
345343
reader.next();
346344
if(reader.isCharacters()){
@@ -574,13 +572,6 @@ private String processReturnBreakContinue(XMLStreamReader reader, int nestedCoun
574572
return stringBuilder.toString();
575573
}
576574

577-
private static void setCriticalityIfAvailable(XMLStreamReader reader, RobotCaseResult caseResult) {
578-
String criticality = reader.getAttributeValue(null, "critical");
579-
if (criticality != null) {
580-
caseResult.setCritical(criticality.equals("yes"));
581-
}
582-
}
583-
584575
@Override
585576
public void checkRoles(RoleChecker roleChecker) throws SecurityException {
586577

src/main/java/hudson/plugins/robot/RobotProjectAction.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ public void doGraph(StaplerRequest2 req, StaplerResponse2 rsp)
9595
+ "/graph?zoomSignificant="+Boolean.valueOf(req.getParameter("zoomSignificant"))
9696
+ "&hd="+Boolean.valueOf(req.getParameter("hd"))
9797
+ "&failedOnly="+Boolean.valueOf(req.getParameter("failedOnly"))
98-
+ "&criticalOnly="+Boolean.valueOf(req.getParameter("criticalOnly"))
9998
+ "&maxBuildsToShow="+Integer.valueOf(req.getParameter("maxBuildsToShow")));
10099

101100
}

src/main/java/hudson/plugins/robot/RobotPublisher.java

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ public class RobotPublisher extends Recorder implements Serializable,
7373
final private boolean enableCache;
7474

7575
//Default to true
76-
private boolean onlyCritical = true;
7776
private boolean countSkippedTests = false;
7877

7978
/**
@@ -87,15 +86,14 @@ public class RobotPublisher extends Recorder implements Serializable,
8786
* @param logFileName Name of Robot log html
8887
* @param passThreshold Threshold of test pass percentage for successful builds
8988
* @param unstableThreshold Threshold of test pass percentage for unstable builds
90-
* @param onlyCritical True if only critical tests are included in pass percentage
9189
* @param otherFiles Other files to be saved
9290
* @param enableCache True if caching is used
9391
*/
9492
@DataBoundConstructor
9593
public RobotPublisher(String archiveDirName, String outputPath, String outputFileName,
9694
boolean disableArchiveOutput, String reportFileName, String logFileName,
9795
double passThreshold, double unstableThreshold,
98-
boolean onlyCritical, boolean countSkippedTests, String otherFiles, boolean enableCache, String overwriteXAxisLabel) {
96+
boolean countSkippedTests, String otherFiles, boolean enableCache, String overwriteXAxisLabel) {
9997
this.archiveDirName = archiveDirName;
10098
this.outputPath = outputPath;
10199
this.outputFileName = outputFileName;
@@ -104,7 +102,6 @@ public RobotPublisher(String archiveDirName, String outputPath, String outputFil
104102
this.passThreshold = passThreshold;
105103
this.unstableThreshold = unstableThreshold;
106104
this.logFileName = logFileName;
107-
this.onlyCritical = onlyCritical;
108105
this.countSkippedTests = countSkippedTests;
109106
this.enableCache = enableCache;
110107
this.overwriteXAxisLabel = overwriteXAxisLabel;
@@ -202,15 +199,6 @@ public double getUnstableThreshold() {
202199
return unstableThreshold;
203200
}
204201

205-
/**
206-
* Gets if only critical tests should be accounted for the thresholds.
207-
*
208-
* @return true if only critical tests should be accounted for the thresholds
209-
*/
210-
public boolean getOnlyCritical() {
211-
return onlyCritical;
212-
}
213-
214202
/**
215203
* Gets if skipped tests should be counted in the thresholds.
216204
*
@@ -274,7 +262,6 @@ public void perform(Run<?, ?> build, @NonNull FilePath workspace, @NonNull EnvVa
274262
if (build.getResult() != Result.ABORTED) {
275263
PrintStream logger = listener.getLogger();
276264
logger.println(Messages.robot_publisher_started());
277-
logger.println(Messages.robot_publisher_only_critical());
278265
logger.println(Messages.robot_publisher_parsing());
279266
RobotResult result;
280267

src/main/java/hudson/plugins/robot/RobotStep.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ public class RobotStep extends Step {
3737
private double unstableThreshold;
3838
private @CheckForNull String[] otherFiles;
3939
private boolean enableCache = true;
40-
private boolean onlyCritical = true;
4140
private boolean countSkippedTests = false;
4241
private @CheckForNull String overwriteXAxisLabel;
4342

@@ -92,10 +91,6 @@ public boolean getEnableCache() {
9291
return this.enableCache;
9392
}
9493

95-
public boolean getOnlyCritical() {
96-
return this.onlyCritical;
97-
}
98-
9994
public boolean getCountSkippedTests() { return this.countSkippedTests; }
10095

10196
public String getOverwriteXAxisLabel() {
@@ -142,11 +137,6 @@ public void setEnableCache(boolean enableCache) {
142137
this.enableCache = enableCache;
143138
}
144139

145-
@DataBoundSetter
146-
public void setOnlyCritical(boolean onlyCritical) {
147-
this.onlyCritical = onlyCritical;
148-
}
149-
150140
@DataBoundSetter
151141
public void setCountSkippedTests(boolean countSkippedTests) {
152142
this.countSkippedTests = countSkippedTests;

src/main/java/hudson/plugins/robot/RobotStepExecution.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public class RobotStepExecution extends SynchronousNonBlockingStepExecution<Void
2929
@Override protected Void run() throws Exception {
3030
FilePath workspace = getContext().get(FilePath.class);
3131
workspace.mkdirs();
32-
RobotPublisher rp = new RobotPublisher(step.getArchiveDirName(), step.getOutputPath(), step.getOutputFileName(), step.getDisableArchiveOutput(), step.getReportFileName(), step.getLogFileName(), step.getPassThreshold(), step.getUnstableThreshold(), step.getOnlyCritical(), step.getCountSkippedTests(), step.getOtherFiles(), step.getEnableCache(), step.getOverwriteXAxisLabel());
32+
RobotPublisher rp = new RobotPublisher(step.getArchiveDirName(), step.getOutputPath(), step.getOutputFileName(), step.getDisableArchiveOutput(), step.getReportFileName(), step.getLogFileName(), step.getPassThreshold(), step.getUnstableThreshold(), step.getCountSkippedTests(), step.getOtherFiles(), step.getEnableCache(), step.getOverwriteXAxisLabel());
3333
rp.perform(getContext().get(Run.class), workspace, getContext().get(EnvVars.class), getContext().get(Launcher.class), getContext().get(TaskListener.class));
3434
return null;
3535
}

src/main/java/hudson/plugins/robot/graph/RobotGraphHelper.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ public class RobotGraphHelper {
3636
* Create a test result trend graph. The graph will ignore builds with no robot results.
3737
* @param significantData True if graph has significant data
3838
* @param binarydata Binary data
39-
* @param criticalOnly True if graph only critical tests
4039
* @param hd True if you want a larger image
4140
* @param labelFormat Label format
4241
* @param rootObject The dataset will be taken from rootObject backwards.
@@ -51,7 +50,6 @@ public static RobotGraph createTestResultsGraphForTestObject(RobotTestObject roo
5150
boolean binarydata,
5251
boolean hd,
5352
boolean failedOnly,
54-
boolean criticalOnly,
5553
String labelFormat,
5654
int maxBuildsToShow) {
5755
List<Number> values = new ArrayList<>();
@@ -65,14 +63,14 @@ public static RobotGraph createTestResultsGraphForTestObject(RobotTestObject roo
6563
testObject != null && buildsLeftToShow != 0;
6664
testObject = testObject.getPreviousResult(), buildsLeftToShow--)
6765
{
68-
Number failed = !criticalOnly ? testObject.getFailed() : testObject.getCriticalFailed();
66+
Number failed = testObject.getFailed();
6967
Number passed = 0;
7068
Number skipped = 0;
7169
int compareLowerBoundTo;
7270
if ( failedOnly) {
7371
compareLowerBoundTo = failed.intValue();
7472
} else {
75-
passed = !criticalOnly ? testObject.getPassed() : testObject.getCriticalPassed();
73+
passed = testObject.getPassed();
7674
skipped = testObject.getSkipped();
7775
compareLowerBoundTo = passed.intValue();
7876
}

src/main/java/hudson/plugins/robot/model/RobotCaseComparator.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@ public int compare(RobotCaseResult result1, RobotCaseResult result2) {
2929
if (!result1.isPassed()) {
3030
if (result2.isPassed())
3131
return -1;
32-
if (result1.isCritical()) {
33-
if (!result2.isCritical())
34-
return -1;
35-
} else if (result2.isCritical())
36-
return 1;
3732
} else if (!result2.isPassed())
3833
return 1;
3934
return result1.getRelativePackageName(result1).compareTo(result2.getRelativePackageName(result2));

0 commit comments

Comments
 (0)