Skip to content

Commit 59da07e

Browse files
committed
#220 add tests
1 parent d2ca4ea commit 59da07e

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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+
}

0 commit comments

Comments
 (0)