Closed rahulkamboj14 closed 6 years ago
@rahulautomation - Screenshot doesn't help. Can you please help paste the entire stack trace here as text along with a sample that can be used ? Please include the supporting gherkin and your step definitions as well so that its easy to reproduce the problem.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building WebIntegration test
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ WebIntegration ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Projects\tfnsw-corp-tests\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.6.1:compile (default-compile) @ WebIntegration ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ WebIntegration ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Projects\tfnsw-corp-tests\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.6.1:testCompile (default-testCompile) @ WebIntegration ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 95 source files to C:\Projects\tfnsw-corp-tests\target\test-classes
[ERROR] error reading C:\Users\KambojR.m2\repository\org\codehaus\groovy\groovy\2.4.6\groovy-2.4.6.jar; invalid LOC header (bad signature)
[INFO] /C:/Projects/tfnsw-corp-tests/src/test/java/driver/LocalDriverFactory.java: Some input files use or override a deprecated API.
[INFO] /C:/Projects/tfnsw-corp-tests/src/test/java/driver/LocalDriverFactory.java: Recompile with -Xlint:deprecation for details.
[INFO] /C:/Projects/tfnsw-corp-tests/src/test/java/reports/JSONReportMerger.java: Some input files use unchecked or unsafe operations.
[INFO] /C:/Projects/tfnsw-corp-tests/src/test/java/reports/JSONReportMerger.java: Recompile with -Xlint:unchecked for details.
[INFO]
[INFO] --- maven-surefire-plugin:2.20.1:test (default-test) @ WebIntegration ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running TestSuite
...
... TestNG 6.14.2 by Cédric Beust (cedric@beust.com)
...
log4j:WARN No appenders could be found for logger (driver.LocalWebDriverListener). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. [Utils] [ERROR] [Error] java.lang.NullPointerException at com.rationaleemotions.TestNGCucumberTests.features(TestNGCucumberTests.java:28) 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:498) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:74) at org.testng.internal.MethodInvocationHelper.invokeMethodNoCheckedException(MethodInvocationHelper.java:45) at org.testng.internal.MethodInvocationHelper.invokeDataProvider(MethodInvocationHelper.java:131) at org.testng.internal.Parameters.handleParameters(Parameters.java:706) at org.testng.internal.ParameterHandler.handleParameters(ParameterHandler.java:49) at org.testng.internal.ParameterHandler.createParameters(ParameterHandler.java:37) at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:923) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)
[INFO] [INFO] Results: [INFO] [INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0 [INFO] [ERROR] There are test failures.
Please refer to C:\Projects\tfnsw-corp-tests\target\surefire-reports for the individual test results. Please refer to dump files (if any exist) [date]-jvmRun[N].dump, [date].dumpstream and [date]-jvmRun[N].dumpstream. There was an error in the forked process null org.apache.maven.surefire.booter.SurefireBooterForkException: There was an error in the forked process null at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:673) at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:535) at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:280) at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:245) at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1124) at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:954) at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:832) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288) at org.apache.maven.cli.MavenCli.main(MavenCli.java:199) 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:498) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
[INFO] [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ WebIntegration --- [INFO] Building jar: C:\Projects\tfnsw-corp-tests\target\WebIntegration-test.jar [INFO] [INFO] --- maven-cucumber-reporting:3.15.0:generate (execution) @ WebIntegration --- ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console. Set system property 'org.apache.logging.log4j.simplelog.StatusLogger.level' to TRACE to show Log4j2 internal initialization logging. [INFO] About to generate Cucumber report. [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 20.492 s [INFO] Finished at: 2018-04-06T12:52:55+10:00 [INFO] Final Memory: 47M/585M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal net.masterthought:maven-cucumber-reporting:3.15.0:generate (execution) on project WebIntegration: Error Found: BUILD FAILED - Check Report For Details -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
package testRunner;
import com.rationaleemotions.Reporters;
import com.rationaleemotions.TestNGCucumberTests;
import cucumber.api.CucumberOptions;
@CucumberOptions(
strict = true,
monochrome = true,
features = {"src/main/java/features/Website"},
dryRun = false,
glue = {"stepDefination"},
tags = {},
plugin = { "json:target/RawJsonResult/Windows7Chrome60.json"}
)
@Reporters( plugin = { "json:target/RawJsonResult/Windows7Chrome60.json"}
)
public class Windows7Chrome60 extends TestNGCucumberTests {
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Local" parallel="tests" thread-count="5" verbose="2">
<listeners>
<listener class-name="driver.LocalWebDriverListener" />
<listener class-name="reports.ExecutionListeners" />
</listeners>
<test name="Test in Chrome" parallel="classes">
<parameter name="browserName" value="chrome" />
<classes>
<class name="testRunner.Windows7Chrome60">
</class>
</classes>
</test>
</suite> <!-- Suite -->
Feature: Website-Validate auto suggest and 404 pages
Scenario: Verify 404 Pages
Given I am at the "User Website"
And I pass the "error404Page2" in the Url
Then I should see the "Page Not Found" page
@Given("^I am at the \"([^\"]*)\"$")
public void i_am_at_the_page(String page) throws Throwable {
websiteHomePage = new Home(driver);
}
@rahulautomation - Thanks a ton for sharing this information. I will investigate the problem and get back to you, hopefully by the end of this weekend.
Thanks @krmahadevan for looking into this.
@rahulautomation - I am not able to reproduce the problem at my end. Here's what I have:
My test runner looks like below
import com.rationaleemotions.Reporters;
import com.rationaleemotions.TestNGCucumberTests;
import cucumber.api.CucumberOptions;
@CucumberOptions(
strict = true,
monochrome = true,
features = {"src/test/resources/features/github1"},
glue = {"com.rationaleemotions.examples.java.stepdefinition"},
plugin = {"json:target/RawJsonResult/Windows7Chrome60.json"}
)
@Reporters(plugin = {"json:target/RawJsonResult/Windows7Chrome60.json"}
)
public class Windows7Chrome60 extends TestNGCucumberTests {
}
My step definition looks like below
package com.rationaleemotions.examples.java.stepdefinition;
import cucumber.api.java.en.And;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
public class Github1 {
@Given("^I am at the \"([^\"]*)\"$")
public void i_am_at_the_something(String strArg1) throws Throwable {
}
@Then("^I should see the \"([^\"]*)\" page$")
public void i_should_see_the_something_page(String strArg1) throws Throwable {
}
@And("^I pass the \"([^\"]*)\" in the Url$")
public void i_pass_the_something_in_the_url(String strArg1) throws Throwable {
}
}
The feature file looks like below
Feature: Website-Validate auto suggest and 404 pages
Scenario: Verify 404 Pages
Given I am at the "User Website"
And I pass the "error404Page2" in the Url
Then I should see the "Page Not Found" page
and it resides in src/test/resources/features/github1/sample.feature
Here's how the suite xml file looks like
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Local" parallel="tests" thread-count="5" verbose="2">
<test name="Test in Chrome" parallel="classes">
<parameter name="browserName" value="chrome"/>
<classes>
<class name="com.rationaleemotions.examples.java.Windows7Chrome60">
</class>
</classes>
</test>
</suite> <!-- Suite -->
and it resides in src/test/resources/suite.xml
Here's my surefire plugin output
[INFO] --- maven-surefire-plugin:2.19.1:test (default-test) @ roadrunner ---
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running TestSuite
...
... TestNG 6.14.2 by Cédric Beust (cedric@beust.com)
...
1 Scenarios (1 passed)
3 Steps (3 passed)
0m0.122s
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.898 sec - in TestSuite
Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
So it would be great if you could please help do the following
mvn archetype:generate
create a dummy project.pom.xml
clean-up the <dependencies>
section in it and add the below dependency
<dependency>
<groupId>com.rationaleemotions</groupId>
<artifactId>cucumber-roadrunner</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
Hi Krishnan, I am still getting the same error. I have added the dummy project, please have a look at the below link. Let me know if you have any problem accessing it.
https://github.com/rahulkamboj14/TestRunner
Hopefully, I have not done any silly mistake.
Thanks, Rahul
@rahulkamboj14
If you read the prerequisites you would notice that I have called explicitly that you cannot change the Cucumber versions and it has to be the version that RoadRunner provides viz., 1.2.5
. But in your pom file of your sample file, I see that you have changed the cucumber and cucumber-testing versions to as below
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-testng</artifactId>
<version>2.4.0</version>
</dependency>
This is what is causing the NullPointerException
. If you pay close attention to the below output you would notice an error which reads java.lang.NoSuchMethodError: cucumber.runtime.RuntimeOptions.addPlugin(Ljava/lang/Object;)V
. This is because my implementation hacks into the cucumber codebase and as such cannot work with any other version apart from what it brings in.
This is a limitation (since I could not find any other way to enable parallel execution support). So you would need to remove off all the cucumber dependencies from your sample project and then run it once again.
I am hoping that once I get some usage of my library, I will start releasing a version that corresponds to each of the cucumber versions (that way its a bit more easier). Since I dont have that usage right now, I am still contemplating.
There's not much that can be done on this one. I am going to have to close this off. Please let me know if you need more information from my side.
[INFO] Running TestSuite
...
... TestNG 6.14.2 by Cédric Beust (cedric@beust.com)
...
[Utils] [ERROR] [Error] java.lang.NullPointerException
at com.rationaleemotions.TestNGCucumberTests.features(TestNGCucumberTests.java:28)
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:498)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:74)
at org.testng.internal.MethodInvocationHelper.invokeMethodNoCheckedException(MethodInvocationHelper.java:45)
at org.testng.internal.MethodInvocationHelper.invokeDataProvider(MethodInvocationHelper.java:131)
at org.testng.internal.Parameters.handleParameters(Parameters.java:706)
at org.testng.internal.ParameterHandler.handleParameters(ParameterHandler.java:49)
at org.testng.internal.ParameterHandler.createParameters(ParameterHandler.java:37)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:923)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:748)
[ERROR] Tests run: 3, Failures: 2, Errors: 0, Skipped: 1, Time elapsed: 0.45 s <<< FAILURE! - in TestSuite
[ERROR] setUpClass(testRunner.Windows7Chrome60) Time elapsed: 0.324 s <<< FAILURE!
java.lang.NoSuchMethodError: cucumber.runtime.RuntimeOptions.addPlugin(Ljava/lang/Object;)V
[ERROR] tearDownClass(testRunner.Windows7Chrome60) Time elapsed: 0.338 s <<< FAILURE!
java.lang.NullPointerException