forked from damianszczepanik/cucumber-reporting
-
Notifications
You must be signed in to change notification settings - Fork 0
/
LiveDemoTest.java
47 lines (40 loc) · 2.08 KB
/
LiveDemoTest.java
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
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import net.masterthought.cucumber.Configuration;
import net.masterthought.cucumber.ReportBuilder;
import net.masterthought.cucumber.presentation.PresentationMode;
import net.masterthought.cucumber.sorting.SortingMethod;
import org.junit.jupiter.api.Test;
/**
* @author Damian Szczepanik (damianszczepanik@github)
*/
class LiveDemoTest {
// test annotation only to make sure it is generated during "mvn test"
// what is needed to publish generated report via github.com
// http://damianszczepanik.github.io/cucumber-html-reports/overview-features.html
@Test
void generateDemoReport() {
File reportOutputDirectory = new File("target/demo");
List<String> jsonFiles = new ArrayList<>();
jsonFiles.add("src/test/resources/json/sample.json");
String buildNumber = "101";
String projectName = "Live Demo Project";
Configuration configuration = new Configuration(reportOutputDirectory, projectName);
configuration.setBuildNumber(buildNumber);
configuration.addClassifications("Browser", "Firefox");
configuration.addClassifications("Branch", "release/1.0");
configuration.setSortingMethod(SortingMethod.NATURAL);
configuration.addPresentationModes(PresentationMode.EXPAND_ALL_STEPS);
configuration.addPresentationModes(PresentationMode.PARALLEL_TESTING);
configuration.setQualifier("sample", "Chrome 80, mobile");
// points to the demo trends which is not used for other tests
configuration.setTrendsStatsFile(new File("target/test-classes/demo-trends.json"));
configuration.addCustomCssFiles(Collections.singletonList("src/test/resources/css/stackoverflow-light.min.css"));
configuration.addCustomJsFiles(Arrays.asList("src/test/resources/js/enable-highlighting.js", "src/test/resources/js/highlight.min.js"));
ReportBuilder reportBuilder = new ReportBuilder(jsonFiles, configuration);
reportBuilder.generateReports();
}
}