From ed0b51f8d571f290137eba98a0e177af265aa4de Mon Sep 17 00:00:00 2001 From: VimalRaj Selvam Date: Mon, 26 Jun 2017 07:42:37 +0530 Subject: [PATCH] Fixed build error and test error --- .../cucumber/listener/ExtentCucumberFormatter.java | 14 +++++--------- .../java/com/cucumber/runner/RunCukesTest.java | 4 ++-- .../com/cucumber/runner/TestNGCukesRunner.java | 4 ++-- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/cucumber/listener/ExtentCucumberFormatter.java b/src/main/java/com/cucumber/listener/ExtentCucumberFormatter.java index 73bb38f..05dad13 100644 --- a/src/main/java/com/cucumber/listener/ExtentCucumberFormatter.java +++ b/src/main/java/com/cucumber/listener/ExtentCucumberFormatter.java @@ -42,15 +42,11 @@ private static void setExtentHtmlReport(File file) { if (htmlReporter != null) { return; } - try { - if (!file.exists()) { - file.getParentFile().mkdirs(); - } - } catch (NullPointerException e) { + if (file == null || file.getPath().isEmpty()) { file = new File(ExtentProperties.INSTANCE.getReportPath()); - if (!file.exists()) { - file.getParentFile().mkdirs(); - } + } + if (!file.exists()) { + file.getParentFile().mkdirs(); } htmlReporter = new ExtentHtmlReporter(file); } @@ -65,7 +61,7 @@ private static void setExtentReport() { } extentReports = new ExtentReports(); ExtentProperties extentProperties = ExtentProperties.INSTANCE; - if (extentProperties.getExtentXServerUrl() != null || !extentProperties.getExtentXServerUrl().isEmpty()) { + if (extentProperties.getExtentXServerUrl() != null) { String extentXServerUrl = extentProperties.getExtentXServerUrl(); try { URL url = new URL(extentXServerUrl); diff --git a/src/test/java/com/cucumber/runner/RunCukesTest.java b/src/test/java/com/cucumber/runner/RunCukesTest.java index f746070..c160fb9 100644 --- a/src/test/java/com/cucumber/runner/RunCukesTest.java +++ b/src/test/java/com/cucumber/runner/RunCukesTest.java @@ -23,8 +23,8 @@ public class RunCukesTest { @BeforeClass public static void setup() { ExtentProperties extentProperties = ExtentProperties.INSTANCE; - extentProperties.setExtentXServerUrl("http://localhost:1337"); - extentProperties.setProjectName("MyProject"); +// extentProperties.setExtentXServerUrl("http://localhost:1337"); +// extentProperties.setProjectName("MyProject"); extentProperties.setReportPath("output/myreport.html"); } diff --git a/src/test/java/com/cucumber/runner/TestNGCukesRunner.java b/src/test/java/com/cucumber/runner/TestNGCukesRunner.java index f24a46f..9cee144 100644 --- a/src/test/java/com/cucumber/runner/TestNGCukesRunner.java +++ b/src/test/java/com/cucumber/runner/TestNGCukesRunner.java @@ -18,8 +18,8 @@ public class TestNGCukesRunner extends AbstractTestNGCucumberTests { @BeforeClass public static void setup() { ExtentProperties extentProperties = ExtentProperties.INSTANCE; - extentProperties.setExtentXServerUrl("http://localhost:1337"); - extentProperties.setProjectName("TestNGProject"); +// extentProperties.setExtentXServerUrl("http://localhost:1337"); +// extentProperties.setProjectName("TestNGProject"); extentProperties.setReportPath("output/myreport.html"); }