Skip to content

Commit 0a86ca3

Browse files
committed
fixes tests, use Spark as default
1 parent 50bf98f commit 0a86ca3

File tree

3 files changed

+39
-55
lines changed

3 files changed

+39
-55
lines changed

src/test/java/com/aventstack/extentreports/reporter/HtmlBasicFileReporterConfigurationTest.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,20 @@ public class HtmlBasicFileReporterConfigurationTest extends Base {
1111

1212
@Test
1313
public void htmlReporterHasInitialConfig(Method method) {
14-
ExtentHtmlReporter html = new ExtentHtmlReporter(method.getName() + ".html");
14+
ExtentSparkReporter html = new ExtentSparkReporter(method.getName() + ".html");
1515
Assert.assertFalse(html.getConfigurationStore().isEmpty());
1616
}
1717

1818
@Test
1919
public void testHtmlReporterUserConfigInitialCSSNull(Method method) {
20-
ExtentHtmlReporter html = new ExtentHtmlReporter(method.getName() + ".html");
20+
ExtentSparkReporter html = new ExtentSparkReporter(method.getName() + ".html");
2121
String v = (String) html.getConfigurationStore().getConfig("css");
2222
Assert.assertNull(v);
2323
}
2424

2525
@Test
2626
public void testHtmlReporterUserConfigCSSHasValue(Method method) {
27-
ExtentHtmlReporter html = new ExtentHtmlReporter(method.getName() + ".html");
27+
ExtentSparkReporter html = new ExtentSparkReporter(method.getName() + ".html");
2828
String css = ".dark{background:black;}";
2929
html.config().setCSS(css);
3030
String v = (String) html.getConfigurationStore().getConfig("css");
@@ -33,7 +33,7 @@ public void testHtmlReporterUserConfigCSSHasValue(Method method) {
3333

3434
@Test
3535
public void testHtmlReporterUserConfigCSSValue(Method method) {
36-
ExtentHtmlReporter html = new ExtentHtmlReporter(method.getName() + ".html");
36+
ExtentSparkReporter html = new ExtentSparkReporter(method.getName() + ".html");
3737
String css = ".dark{background:black;}";
3838
html.config().setCSS(css);
3939
String v = (String) html.getConfigurationStore().getConfig("css");
@@ -42,22 +42,22 @@ public void testHtmlReporterUserConfigCSSValue(Method method) {
4242

4343
@Test
4444
public void testHtmlReporterUserConfigInitialJSNull(Method method) {
45-
ExtentHtmlReporter html = new ExtentHtmlReporter(method.getName() + ".html");
45+
ExtentSparkReporter html = new ExtentSparkReporter(method.getName() + ".html");
4646
String v = (String) html.getConfigurationStore().getConfig("js");
4747
Assert.assertNull(v);
4848
}
4949

5050
@Test
5151
public void testHtmlReporterUserConfigJSHasValue(Method method) {
52-
ExtentHtmlReporter html = new ExtentHtmlReporter(method.getName() + ".html");
52+
ExtentSparkReporter html = new ExtentSparkReporter(method.getName() + ".html");
5353
html.config().setJS("alert('');");
5454
String v = (String) html.getConfigurationStore().getConfig("js");
5555
Assert.assertFalse(v.isEmpty());
5656
}
5757

5858
@Test
5959
public void testHtmlReporterUserConfigJSValue(Method method) {
60-
ExtentHtmlReporter html = new ExtentHtmlReporter(method.getName() + ".html");
60+
ExtentSparkReporter html = new ExtentSparkReporter(method.getName() + ".html");
6161
String js = "alert('');";
6262
html.config().setJS(js);
6363
String v = (String) html.getConfigurationStore().getConfig("js");
@@ -66,20 +66,20 @@ public void testHtmlReporterUserConfigJSValue(Method method) {
6666

6767
@Test
6868
public void documentTitleInitialValueTest(Method method) {
69-
ExtentHtmlReporter html = new ExtentHtmlReporter(method.getName() + ".html");
69+
ExtentSparkReporter html = new ExtentSparkReporter(method.getName() + ".html");
7070
Assert.assertFalse(html.getConfigurationStore().getConfig("documentTitle").toString().isEmpty());
7171
}
7272

7373
@Test
7474
public void documentTitleInitialUserValueTest(Method method) {
75-
ExtentHtmlReporter html = new ExtentHtmlReporter(method.getName() + ".html");
75+
ExtentSparkReporter html = new ExtentSparkReporter(method.getName() + ".html");
7676
String v = (String) html.getConfigurationStore().getConfig("documentTitle");
7777
Assert.assertNotNull(v);
7878
}
7979

8080
@Test
8181
public void documentTitleUserValueTest(Method method) {
82-
ExtentHtmlReporter html = new ExtentHtmlReporter(method.getName() + ".html");
82+
ExtentSparkReporter html = new ExtentSparkReporter(method.getName() + ".html");
8383
String docTitle = "test";
8484
html.config().setDocumentTitle(docTitle);
8585
String v = (String) html.getConfigurationStore().getConfig("documentTitle");
@@ -88,20 +88,20 @@ public void documentTitleUserValueTest(Method method) {
8888

8989
@Test
9090
public void encodingInitialValueTest(Method method) {
91-
ExtentHtmlReporter html = new ExtentHtmlReporter(method.getName() + ".html");
91+
ExtentSparkReporter html = new ExtentSparkReporter(method.getName() + ".html");
9292
Assert.assertTrue(html.getConfigurationStore().getConfig("encoding").toString().equalsIgnoreCase("utf-8"));
9393
}
9494

9595
@Test
9696
public void encodingInitialUserValueTest(Method method) {
97-
ExtentHtmlReporter html = new ExtentHtmlReporter(method.getName() + ".html");
97+
ExtentSparkReporter html = new ExtentSparkReporter(method.getName() + ".html");
9898
String v = (String) html.getConfigurationStore().getConfig("encoding");
9999
Assert.assertNotNull(v);
100100
}
101101

102102
@Test
103103
public void encodingUserValueTest(Method method) {
104-
ExtentHtmlReporter html = new ExtentHtmlReporter(method.getName() + ".html");
104+
ExtentSparkReporter html = new ExtentSparkReporter(method.getName() + ".html");
105105
String encoding = "utf-16";
106106
html.config().setEncoding(encoding);
107107
String v = (String) html.getConfigurationStore().getConfig("encoding");

src/test/java/com/aventstack/extentreports/reporter/HtmlConfigurableReporterTest.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,47 +19,47 @@ public class HtmlConfigurableReporterTest extends Base {
1919
private static final String CSS = ".test.active { border: 1px solid #ccc; }";
2020
private static final String JS = "$('.test').click(function() { console.log('test'); });";
2121

22-
private ExtentHtmlReporter html;
22+
private ExtentSparkReporter spark;
2323

2424
@BeforeClass
2525
public void beforeClass() {
26-
html = new ExtentHtmlReporter("Extent.html");
27-
html.loadXMLConfig(CONFIG_PATH);
26+
spark = new ExtentSparkReporter("Extent.html");
27+
spark.loadXMLConfig(CONFIG_PATH);
2828
}
2929

3030
@Test
3131
public void testTheme(Method method) {
32-
Assert.assertEquals(html.getConfigurationStore().getConfig("theme"), THEME);
32+
Assert.assertEquals(spark.getConfigurationStore().getConfig("theme"), THEME);
3333
}
3434

3535
@Test
3636
public void testEncoding(Method method) {
37-
Assert.assertTrue(String.valueOf(html.getConfigurationStore().getConfig("encoding")).equalsIgnoreCase(ENCODING));
37+
Assert.assertTrue(String.valueOf(spark.getConfigurationStore().getConfig("encoding")).equalsIgnoreCase(ENCODING));
3838
}
3939

4040
@Test
4141
public void testDocumentTitle(Method method) {
42-
Assert.assertEquals(html.getConfigurationStore().getConfig("documentTitle"), DOCUMENT_TITLE);
42+
Assert.assertEquals(spark.getConfigurationStore().getConfig("documentTitle"), DOCUMENT_TITLE);
4343
}
4444

4545
@Test
4646
public void testReportName(Method method) {
47-
Assert.assertEquals(html.getConfigurationStore().getConfig("reportName"), REPORT_NAME);
47+
Assert.assertEquals(spark.getConfigurationStore().getConfig("reportName"), REPORT_NAME);
4848
}
4949

5050
@Test
5151
public void testTimestampFormat(Method method) {
52-
Assert.assertEquals(html.getConfigurationStore().getConfig("timeStampFormat"), TIMESTAMP_FORMAT);
52+
Assert.assertEquals(spark.getConfigurationStore().getConfig("timeStampFormat"), TIMESTAMP_FORMAT);
5353
}
5454

5555
@Test
5656
public void testCSS(Method method) {
57-
Assert.assertTrue(html.getConfigurationStore().getConfig("styles").toString().contains(CSS));
57+
Assert.assertTrue(spark.getConfigurationStore().getConfig("styles").toString().contains(CSS));
5858
}
5959

6060
@Test
6161
public void testJS(Method method) {
62-
Assert.assertTrue(html.getConfigurationStore().getConfig("scripts").toString().contains(JS));
62+
Assert.assertTrue(spark.getConfigurationStore().getConfig("scripts").toString().contains(JS));
6363
}
6464

6565
}

src/test/java/com/aventstack/extentreports/reporter/HtmlRichViewReporterConfigurationTest.java

Lines changed: 16 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -12,65 +12,49 @@ public class HtmlRichViewReporterConfigurationTest {
1212

1313
@Test
1414
public void testHtmlReporterUserConfigEnableTimelineEnabled(Method method) {
15-
ExtentHtmlReporter html = new ExtentHtmlReporter(method.getName() + ".html");
16-
html.config().enableTimeline(true);
17-
String v = (String) html.getConfigurationStore().getConfig("enableTimeline");
15+
ExtentSparkReporter spark = new ExtentSparkReporter(method.getName() + ".html");
16+
spark.config().enableTimeline(true);
17+
String v = (String) spark.getConfigurationStore().getConfig("enableTimeline");
1818
Assert.assertEquals(v, String.valueOf(true));
1919
}
2020

2121
@Test
2222
public void testHtmlReporterUserConfigEnableTimelineDisabled(Method method) {
23-
ExtentHtmlReporter html = new ExtentHtmlReporter(method.getName() + ".html");
24-
html.config().enableTimeline(false);
25-
String v = (String) html.getConfigurationStore().getConfig("enableTimeline");
23+
ExtentSparkReporter spark = new ExtentSparkReporter(method.getName() + ".html");
24+
spark.config().enableTimeline(false);
25+
String v = (String) spark.getConfigurationStore().getConfig("enableTimeline");
2626
Assert.assertEquals(v, String.valueOf(false));
2727
}
28-
/*
29-
@Test
30-
public void testHtmlReporterUserConfigAutoConfigMediaEnabled(Method method) {
31-
ExtentHtmlReporter html = new ExtentHtmlReporter(method.getName() + ".html");
32-
html.config().setAutoCreateRelativePathMedia(true);
33-
String v = (String) html.getConfigurationStore().getConfig("autoCreateRelativePathMedia");
34-
Assert.assertEquals(v, String.valueOf(true));
35-
}
3628

37-
@Test
38-
public void testHtmlReporterUserConfigAutoConfigMediaDisabled(Method method) {
39-
ExtentHtmlReporter html = new ExtentHtmlReporter(method.getName() + ".html");
40-
html.config().setAutoCreateRelativePathMedia(false);
41-
String v = (String) html.getConfigurationStore().getConfig("autoCreateRelativePathMedia");
42-
Assert.assertEquals(v, String.valueOf(false));
43-
}
44-
*/
4529
@Test
4630
public void testHtmlReporterUserConfigDetaultProtocol(Method method) {
47-
ExtentHtmlReporter html = new ExtentHtmlReporter(method.getName() + ".html");
48-
String v = (String) html.getConfigurationStore().getConfig("protocol");
31+
ExtentSparkReporter spark = new ExtentSparkReporter(method.getName() + ".html");
32+
String v = (String) spark.getConfigurationStore().getConfig("protocol");
4933
Assert.assertEquals(Enum.valueOf(Protocol.class, v.toUpperCase()), Protocol.HTTPS);
5034
}
5135

5236
@Test
5337
public void testHtmlReporterUserConfigProtocolSetting(Method method) {
54-
ExtentHtmlReporter html = new ExtentHtmlReporter(method.getName() + ".html");
55-
html.config().setProtocol(Protocol.HTTP);
56-
Object p = html.getConfigurationStore().getConfig("protocol");
38+
ExtentSparkReporter spark = new ExtentSparkReporter(method.getName() + ".html");
39+
spark.config().setProtocol(Protocol.HTTP);
40+
Object p = spark.getConfigurationStore().getConfig("protocol");
5741
Protocol v = Protocol.valueOf(String.valueOf(p).toUpperCase());
5842
Assert.assertEquals(v, Protocol.HTTP);
5943
}
6044

6145
@Test
6246
public void testHtmlReporterUserConfigDetaultTheme(Method method) {
63-
ExtentHtmlReporter html = new ExtentHtmlReporter(method.getName() + ".html");
64-
Object t = html.getConfigurationStore().getConfig("theme");
47+
ExtentSparkReporter spark = new ExtentSparkReporter(method.getName() + ".html");
48+
Object t = spark.getConfigurationStore().getConfig("theme");
6549
Theme theme = Theme.valueOf(String.valueOf(t).toUpperCase());
6650
Assert.assertEquals(theme, Theme.STANDARD);
6751
}
6852

6953
@Test
7054
public void testHtmlReporterUserConfigThemeSetting(Method method) {
71-
ExtentHtmlReporter html = new ExtentHtmlReporter(method.getName() + ".html");
72-
html.config().setTheme(Theme.DARK);
73-
Object t = html.config().getConfigurationStore().getConfig("theme");
55+
ExtentSparkReporter spark = new ExtentSparkReporter(method.getName() + ".html");
56+
spark.config().setTheme(Theme.DARK);
57+
Object t = spark.config().getConfigurationStore().getConfig("theme");
7458
Theme theme = Theme.valueOf(String.valueOf(t).toUpperCase());
7559
Assert.assertEquals(theme, Theme.DARK);
7660
}

0 commit comments

Comments
 (0)