File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed
src/test/java/com/aventstack/extentreports/reporter Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change 1+ package com .aventstack .extentreports .reporter ;
2+
3+ import java .io .File ;
4+ import java .io .IOException ;
5+ import java .nio .file .Files ;
6+
7+ import org .testng .Assert ;
8+ import org .testng .annotations .BeforeMethod ;
9+ import org .testng .annotations .Test ;
10+
11+ import com .aventstack .extentreports .ExtentReports ;
12+
13+ public class SparkTagTest {
14+ private static final String PATH = "target/spark.html" ;
15+ private static final String TAG = "TAG#1234" ;
16+
17+ private ExtentReports extent ;
18+
19+ @ BeforeMethod
20+ public void before () {
21+ extent = new ExtentReports ();
22+ extent .attachReporter (new ExtentSparkReporter (PATH ));
23+ }
24+
25+ @ Test
26+ public void testTag () throws IOException {
27+ extent .createTest ("Test" ).assignCategory (TAG );
28+ extent .flush ();
29+ Assert .assertTrue (Files .readAllLines (new File (PATH ).toPath ()).stream ()
30+ .anyMatch (x -> x .contains (TAG )));
31+ }
32+
33+ @ Test
34+ public void nodeTag () throws IOException {
35+ extent .createTest ("Test" ).createNode ("Node" ).assignCategory (TAG );
36+ extent .flush ();
37+ Assert .assertTrue (Files .readAllLines (new File (PATH ).toPath ()).stream ()
38+ .anyMatch (x -> x .contains (TAG )));
39+ }
40+ }
You can’t perform that action at this time.
0 commit comments