Uploaded image for project: 'Maven Surefire'
  1. Maven Surefire
  2. SUREFIRE-1625

cucumber.runtime.CucumberException: java.lang.NullPointerException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • None
    • OS :Debian
      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
      MAVEN +JUNIT + CUCUMBER

    Description

      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 :

      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

      <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
      	<modelVersion>4.0.0</modelVersion>
      	<groupId>api</groupId>
      	<artifactId>ApiAutomation</artifactId>
      	<packaging>jar</packaging>
      	<version>1.0-SNAPSHOT</version>
      	<name>CitRestAssured</name>
      	<url>http://maven.apache.org</url>
      	<properties>
      	    <maven.compiler.source>1.8</maven.compiler.source>
      	    <maven.compiler.target>1.8</maven.compiler.target>
      	  </properties>
      	<build>
      		<plugins>
      			<!--<plugin>
      				<groupId>org.apache.maven.plugins</groupId>
      				<artifactId>maven-compiler-plugin</artifactId>
      				<version>3.7.0</version>
      				<configuration>
      					<source>1.8</source>
      					<target>1.8</target>
      					<fork>true</fork>
      					<executable>${env.JAVA_HOME}/bin/javac.exe</executable>
      					<source>1.8</source>
      					<target>1.8</target>
      					
      				</configuration>
      			</plugin>-->
      		<plugin>
      			    <groupId>org.apache.maven.plugins</groupId>
      			    <artifactId>maven-compiler-plugin</artifactId>
      			    <version>3.7.0</version>
      			    <configuration>
      				<executable>${env.JAVA_HOME}/bin/javac.exe</executable>
      			    </configuration>
      		</plugin>
      
      		 <plugin>
                          <groupId>org.apache.maven.plugins</groupId>
                          <artifactId>maven-jar-plugin</artifactId>
                          <configuration>
                              <archive>
                                  <manifest>
                                      <mainClass>com.kub.App</mainClass>
                                  </manifest>
                              </archive>
                          </configuration>
      		</plugin>
      		
      		<!--		<plugin>
      		        <groupId>org.apache.maven.plugins</groupId>
      		        <artifactId>maven-surefire-plugin</artifactId>
      		        <version>3.0.0-M2</version>
      			<configuration>
      			<scope>test</scope>
      			<includes>
      		            <include>ApiRunner.java</include>
      			</includes>
      		        </configuration>
      		</plugin>-->
      		 <plugin>
      		      <artifactId>maven-surefire-plugin</artifactId>
      		      <version>2.21.0</version>
      		       <configuration>
                              <scope>test</scope>
                              <includes>
                                  <include>ApiRunner.java</include>
                              </includes>
                              </configuration>
      	      <dependencies>
      		        <dependency>
      		          <groupId>org.ow2.asm</groupId>
      		          <artifactId>asm</artifactId>
      		          <version>6.2</version> 
      		        </dependency>
      	      </dependencies>
      	    </plugin>
      	</plugins>
      
      	</build>
      	<!--<properties>
      		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
      	</properties>-->
      
      
      	<dependencies>
      		<dependency>
      			    <groupId>org.apache.maven.plugins</groupId>
      			    <artifactId>maven-compiler-plugin</artifactId>
      			    <version>3.0</version>
      		</dependency>
      		<dependency>
      			<groupId>com.sun</groupId>
      			<artifactId>tools</artifactId>
      			<version>1.8</version>
      			<scope>system</scope>
      			<systemPath>${env.JAVA_HOME}/lib/tools.jar</systemPath>
      		</dependency>
      		<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
      		<dependency>
      		    <groupId>commons-io</groupId>
      		    <artifactId>commons-io</artifactId>
      		    <version>2.4</version>
      		</dependency>
      		<!-- https://mvnrepository.com/artifact/commons-cli/commons-cli -->
      		<dependency>
      		    <groupId>commons-cli</groupId>
      		    <artifactId>commons-cli</artifactId>
      		    <version>1.2</version>
      		</dependency>
      		<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
      		<dependency>
      		    <groupId>org.apache.commons</groupId>
      		    <artifactId>commons-lang3</artifactId>
      		    <version>3.7</version>
      		</dependency>
      		<!-- https://mvnrepository.com/artifact/org.apache.maven/maven-plugin-api -->
      		<dependency>
      		    <groupId>org.apache.maven</groupId>
      		    <artifactId>maven-plugin-api</artifactId>
      		    <version>3.5.2</version>
      		</dependency>
      		<!-- https://mvnrepository.com/artifact/xpp3/xpp3 -->
      		<dependency>
      		    <groupId>xpp3</groupId>
      		    <artifactId>xpp3</artifactId>
      		    <version>1.1.4c</version>
      		</dependency>
      		<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-io -->
      		<dependency>
      		    <groupId>org.apache.commons</groupId>
      		    <artifactId>commons-io</artifactId>
      		    <version>1.3.2</version>
      		</dependency>
      		<!-- https://mvnrepository.com/artifact/com.jayway.restassured/json-path -->
      		<dependency>
      		    <groupId>com.jayway.restassured</groupId>
      		    <artifactId>json-path</artifactId>
      		    <version>2.9.0</version>
      		</dependency>
      		
      		<!-- https://mvnrepository.com/artifact/com.jayway.restassured/rest-assured -->
      		<dependency>
      		    <groupId>com.jayway.restassured</groupId>
      		    <artifactId>rest-assured</artifactId>
      		    <version>2.9.0</version>
      		    <scope>test</scope>
      		</dependency>
      		<dependency>
      			<groupId>org.seleniumhq.selenium</groupId>
      			<artifactId>selenium-java</artifactId>
      			<version>3.11.0</version>
      			<scope>compile</scope>
      		</dependency>
      		<dependency>
      			<groupId>info.cukes</groupId>
      			<artifactId>cucumber-java</artifactId>
      			<version>1.2.5</version>
      			<scope>compile</scope>
      		</dependency>
      		<dependency>
      			<groupId>info.cukes</groupId>
      			<artifactId>cucumber-jvm</artifactId>
      			<version>1.2.5</version>
      			<type>pom</type>
      		</dependency>
      		<dependency>
      			<groupId>info.cukes</groupId>
      			<artifactId>gherkin</artifactId>
      			<version>2.12.2</version>
      			<scope>provided</scope>
      		</dependency>
      		<dependency>
      			<groupId>info.cukes</groupId>
      			<artifactId>cucumber-junit</artifactId>
      			<version>1.2.5</version>
      			<scope>test</scope>
      		</dependency>
      		<dependency>
      			<groupId>junit</groupId>
      			<artifactId>junit</artifactId>
      			<version>4.12</version>
      			<scope>compile</scope>
      			</dependency>
      		<!-- https://mvnrepository.com/artifact/com.jayway.jsonpath/json-path -->
      		<dependency>
      		    <groupId>com.jayway.jsonpath</groupId>
      		    <artifactId>json-path</artifactId>
      		    <version>2.2.0</version>
      		</dependency>
      		
      		<dependency>
      			<groupId>com.vimalselvam</groupId>
      			<artifactId>cucumber-extentsreport</artifactId>
      			<version>3.0.0</version>
      			<scope>test</scope>
      		</dependency>
      		<!-- pom.xml -->
      		<dependency>
      			<groupId>com.aventstack</groupId>
      			<artifactId>extentreports</artifactId>
      			<version>3.1.5</version>
      			<scope>test</scope>
      		</dependency>
      		<dependency>
      			<groupId>com.googlecode.json-simple</groupId>
      			<artifactId>json-simple</artifactId>
      			<version>1.1</version>
      			<scope>test</scope>
      		</dependency>
      		<!-- https://mvnrepository.com/artifact/log4j/log4j -->
      		<dependency>
      			<groupId>log4j</groupId>
      			<artifactId>log4j</artifactId>
      			<version>1.2.17</version>
      			<scope>compile</scope>
      		</dependency>
      		<!-- https://mvnrepository.com/artifact/com.relevantcodes/extentreports -->
      		<dependency>
      			<groupId>com.relevantcodes</groupId>
      			<artifactId>extentreports</artifactId>
      			<version>2.41.2</version>
      			<scope>test</scope>
      		</dependency>
      
      		<!-- Rest Assured Dependencies -->
      		<!-- https://mvnrepository.com/artifact/io.rest-assured/rest-assured -->
      		<dependency>
      		    <groupId>io.rest-assured</groupId>
      		    <artifactId>rest-assured</artifactId>
      		    <version>3.0.0</version>
      		    <scope>compile</scope>
      		</dependency>
      
      		<!-- Use to parse JSON Documents -->
      		<!-- https://mvnrepository.com/artifact/io.rest-assured/rest-assured -->
      		<dependency>
      			<groupId>io.rest-assured</groupId>
      			<artifactId>json-path</artifactId>
      			<version>3.0.0</version>
      			<scope>compile</scope>
      		</dependency>
      
      		<!-- Use Validate JSON response with JSON schema -->
      		<!-- https://mvnrepository.com/artifact/io.rest-assured/rest-assured -->
      		<dependency>
      			<groupId>io.rest-assured</groupId>
      			<artifactId>json-schema-validator</artifactId>
      			<version>3.0.0</version>
      			<scope>compile</scope>
      		</dependency>
      		<!-- Use to parse XML Documents -->
      		<!-- https://mvnrepository.com/artifact/io.rest-assured/rest-assured -->
      		<dependency>
      			<groupId>io.rest-assured</groupId>
      			<artifactId>xml-path</artifactId>
      			<version>3.0.2</version>
      			<scope>test</scope>
      		</dependency>
      
      		<!-- Use to Regex Handling -->
      		<dependency>
      			<groupId>org.hamcrest</groupId>
      			<artifactId>java-hamcrest</artifactId>
      			<version>2.0.0.0</version>
      		</dependency>
      		<!-- https://mvnrepository.com/artifact/org.json/json -->
      		<dependency>
      			<groupId>org.json</groupId>
      			<artifactId>json</artifactId>
      			<version>20160810</version>
      		</dependency>
      
      
      	
      	</dependencies>
      </project>
      <!-- Maven manual install steps: mvn archetype:generate -DgroupId=com.mycompany.app 
      	-DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false 
      	mvn install:install-file -Dfile=C:\Workspace\CIS_Automation\testAutomation\testautomation.jar 
      	-DgroupId=automation -DartifactId=automation -Dversion=1.0 -Dpackaging=jar -->
      
      

      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

      Attachments

        Activity

          People

            Unassigned Unassigned
            gagan11 Gagan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: