Closed iamthrilok closed 7 years ago
@iamthrilok : I'm unable to reproduce the issue that you had reported. Kindly find my runner class as follows. This works perfectly:
package com.cucumber.runner;
import com.cucumber.listener.Reporter;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
import org.junit.AfterClass;
import org.junit.runner.RunWith;
import java.io.File;
/**
* A sample test to demonstrate
*/
@RunWith(Cucumber.class)
@CucumberOptions(
features = {"src/test/resources/features"},
glue = {"com.cucumber.stepdefinitions"},
plugin = {"com.cucumber.listener.ExtentCucumberFormatter:output/report.html"}
)
public class RunCukesTest {
@AfterClass
public static void setup() {
Reporter.loadXMLConfig(new File("src/test/resources/extent-config.xml"));
Reporter.setSystemInfo("user", System.getProperty("user.name"));
Reporter.setSystemInfo("os", "Mac OSX");
Reporter.setTestRunnerOutput("Sample test runner output message");
}
}
Kindly reopen in case you need further help.
Hi Vimal I am getting below Null pointer exception, can you please assist me
error: java.lang.NullPointerException at com.aventstack.extentreports.configuration.ConfigLoader.getConfigurationHash(ConfigLoader.java:67) at com.aventstack.extentreports.reporter.AbstractReporter.loadXMLConfig(AbstractReporter.java:59) at com.cucumber.listener.Reporter.loadXMLConfig(Reporter.java:56) at Registrations.runTest.setup(runTest.java:29) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:33) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at cucumber.api.junit.Cucumber.run(Cucumber.java:98) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
############################### I have Java 8 in my machine, I tried with @Before class as well but no luck:( ###############################
My runtest :
package Registrations;
import com.cucumber.listener.Reporter; import cucumber.api.CucumberOptions; import cucumber.api.junit.Cucumber; import org.junit.AfterClass; import org.junit.runner.RunWith;
import java.io.File;
//import cucumber.junit.Cucumber;
@RunWith(Cucumber.class) @CucumberOptions(format = {"pretty", "html:target/cucumber"}, features = {"src//test//java//Registrations//Registration.feature"}, //glue = {"com.cucumber.stepdefinitions"}, //plugin = {"com.cucumber.listener.ExtentCucumberFormatter:output/report.html"} plugin = {"com.cucumber.listener.ExtentCucumberFormatter:Output/Report.html"} //plugin = {"html:target/cucumber-html-report"} )
public class runTest { @AfterClass public static void setup() throws Throwable{
}
Dependencies: