apache / apache/maven-surefire

[SUREFIRE-1625] cucumber.runtime.CucumberException: java.lang.NullPointerException

Open
#2,285 3 comments 0 reactions 0 assignees View on GitHub
bug priority:major
Dominant language
Java
Stars
461
Forks
588
Avg merge
1d 8h
Merged PRs (30d)
19

Description

**[Gagan](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=gagan11)** opened **[SUREFIRE-1625](https://issues.apache.org/jira/browse/SUREFIRE-1625?redirect=false)** and commented

**cucumber.runtime.CucumberException: java.lang.NullPointerException**

---

I am using Cucumber-Maven-Junit as a API automation frameowrk.

Framework was developed on Windows OS where everything was working fine when execution was done using maven commands (mvn clean ,test)..

Now our requirement is to run on Debian OS (Ubuntu.)

Version : Linux ubuntu 4.15.0-20-generic #21-Ubuntu SMP Tue Apr 24 06:16:15 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Now after setiing up environment in debian and using mvn test command results with an error.

Attaching my pon.xml and logs for mvn test command.

 

**mvn test logs :**

```java
gagan@ubuntu:~/ApiAutomationFramework$ mvn test
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for api:ApiAutomationcit:jar:1.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-jar-plugin is missing. @ line 39, column 12
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building citRestAssured 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ ApiAutomationcit ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ ApiAutomationcit ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 39 source files to /home/gagan/ApiAutomationFramework/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ ApiAutomationcit ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 14 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:testCompile (default-testCompile) @ ApiAutomationcit ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.21.0:test (default-test) @ ApiAutomationcit ---
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-junit4/2.21.0/surefire-junit4-2.21.0.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-junit4/2.21.0/surefire-junit4-2.21.0.pom (3.1 kB at 2.5 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-providers/2.21.0/surefire-providers-2.21.0.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-providers/2.21.0/surefire-providers-2.21.0.pom (2.5 kB at 9.2 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-junit4/2.21.0/surefire-junit4-2.21.0.jar
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-junit4/2.21.0/surefire-junit4-2.21.0.jar (85 kB at 133 kB/s)
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.pit.cit.testrunner.ApiRunner
filename is: target\cucumber-reports\report_20190122_112837.html
[ERROR] Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 1.059 s <<< FAILURE! - in com.pit.cit.testrunner.ApiRunner
[ERROR] com.pit.cit.testrunner.ApiRunner Time elapsed: 1.054 s <<< ERROR!
cucumber.runtime.CucumberException: java.lang.NullPointerException
Caused by: java.lang.NullPointerException

[ERROR] com.pit.cit.testrunner.ApiRunner Time elapsed: 1.058 s <<< ERROR!
cucumber.runtime.CucumberException: java.lang.NullPointerException
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:273)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159)
Caused by: java.lang.NullPointerException
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:273)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159)

[INFO]
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR] ApiRunner.com.pit.cit.testrunner.ApiRunner » Cucumber java.lang.NullPointerExc...
[ERROR] JUnit4Provider.invoke:159->executeTestSet:238->executeWithRerun:273->execute:365 » Cucumber
[INFO]
[ERROR] Tests run: 2, Failures: 0, Errors: 2, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.923 s
[INFO] Finished at: 2019-01-22T11:28:38+05:30
[INFO] Final Memory: 28M/74M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.21.0:test (default-test) on project ApiAutomationcit: There are test failures.
[ERROR]
[ERROR] Please refer to /home/gagan/ApiAutomationFramework/target/surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date]-jvmRun[N].dump, [date].dumpstream and [date]-jvmRun[N].dumpstream.
[ERROR] -> [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/MojoFailureException
gagan@ubuntu:~/ApiAutomationFramework$

```

---

**POM.XML**

```java

4.0.0
api
ApiAutomation
jar
1.0-SNAPSHOT
CitRestAssured
http://maven.apache.org

1.8
1.8





org.apache.maven.plugins
maven-compiler-plugin
3.7.0

${env.JAVA_HOME}/bin/javac.exe


org.apache.maven.plugins
maven-jar-plugin



com.kub.App







maven-surefire-plugin
2.21.0

test

ApiRunner.java




org.ow2.asm
asm
6.2






org.apache.maven.plugins
maven-compiler-plugin
3.0


com.sun
tools
1.8
system
${env.JAVA_HOME}/lib/tools.jar



commons-io
commons-io
2.4



commons-cli
commons-cli
1.2



org.apache.commons
commons-lang3
3.7



org.apache.maven
maven-plugin-api
3.5.2



xpp3
xpp3
1.1.4c



org.apache.commons
commons-io
1.3.2



com.jayway.restassured
json-path
2.9.0




com.jayway.restassured
rest-assured
2.9.0
test


org.seleniumhq.selenium
selenium-java
3.11.0
compile


info.cukes
cucumber-java
1.2.5
compile


info.cukes
cucumber-jvm
1.2.5
pom


info.cukes
gherkin
2.12.2
provided


info.cukes
cucumber-junit
1.2.5
test


junit
junit
4.12
compile



com.jayway.jsonpath
json-path
2.2.0



com.vimalselvam
cucumber-extentsreport
3.0.0
test



com.aventstack
extentreports
3.1.5
test


com.googlecode.json-simple
json-simple
1.1
test



log4j
log4j
1.2.17
compile



com.relevantcodes
extentreports
2.41.2
test




io.rest-assured
rest-assured
3.0.0
compile




io.rest-assured
json-path
3.0.0
compile




io.rest-assured
json-schema-validator
3.0.0
compile




io.rest-assured
xml-path
3.0.2
test



org.hamcrest
java-hamcrest
2.0.0.0



org.json
json
20160810


```

---

**Observation**
I am not sure whether I am missing any configuration or is it surefireplugin issue.
I have tried using maven-surefire-plugin version 2.21.0 and 3.0.0-M2

---

**Any help would be highly appreciated.**

**Thanks in advance**

---
No further details from [SUREFIRE-1625](https://issues.apache.org/jira/browse/SUREFIRE-1625?redirect=false)

Contributor guide

Open the contributing guide

Research direction

Start with the attached pom.xml and the com.pit.cit.testrunner.ApiRunner entry point, then reproduce the failure with mvn test on Ubuntu. Inspect target/surefire-reports and the JUnit4Provider stack trace to determine whether the NPE is caused by Surefire or the user's Cucumber setup. Done requires a confirmed Surefire defect, a focused regression case, and verified test execution.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.