-
Notifications
You must be signed in to change notification settings - Fork 405
Expand file tree
/
Copy pathRemoveFailuresDueToRetriesTest.java
More file actions
69 lines (54 loc) · 2.49 KB
/
RemoveFailuresDueToRetriesTest.java
File metadata and controls
69 lines (54 loc) · 2.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package net.masterthought.cucumber;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
import org.apache.commons.io.FileUtils;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import net.masterthought.cucumber.json.support.Status;
import net.masterthought.cucumber.presentation.PresentationMode;
import net.masterthought.cucumber.reducers.ReducingMethod;
public class RemoveFailuresDueToRetriesTest {
private static final String WITH_RETRIES_JSON = "with-retries.json";
File reportDir;
File jsonFile;
@Before
public void before() throws IOException {
File target = new File("target");
reportDir = new File(target, UUID.randomUUID().toString());
reportDir.mkdirs();
jsonFile = new File(reportDir, WITH_RETRIES_JSON);
FileUtils.copyInputStreamToFile(this.getClass().getResourceAsStream("/json/" + WITH_RETRIES_JSON), jsonFile);
}
@After
public void after() throws IOException {
FileUtils.deleteDirectory(reportDir);
}
@Test
public void testRetryRemoval() throws IOException {
File reportOutputDirectory = reportDir;
List<String> jsonFiles = new ArrayList<>();
jsonFiles.add(jsonFile.getAbsolutePath());
String buildNumber = "1";
String projectName = "cucumberProject";
Configuration configuration = new Configuration(reportOutputDirectory, projectName);
// optional configuration - check javadoc for details
configuration.addPresentationModes(PresentationMode.RUN_WITH_JENKINS);
// do not make scenario failed when step has status SKIPPED
configuration.setNotFailingStatuses(Collections.singleton(Status.SKIPPED));
configuration.setBuildNumber(buildNumber);
// addidtional metadata presented on main page
configuration.addClassifications("Platform", "Windows");
configuration.addClassifications("Browser", "Google Chrome");
configuration.addClassifications("Branch", "release/1.0");
configuration.addReducingMethod(ReducingMethod.KEEP_ONLY_LATEST_SCENARIO_RUNS);
ReportBuilder reportBuilder = new ReportBuilder(jsonFiles, configuration);
Reportable result = reportBuilder.generateReports();
Assert.assertEquals("Should not report the retried steps as failures!", 0, result.getFailedSteps());
}
}