0

I am able to run my cucumber project as a junit test but unable to run it using maven. I am getting error:

[INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.3.2:java (default) on project ericsson.com: An exception occured while executing the Java class. cucumber.api.cli.Main -> [Help 1]

I think the problem lies within my POM.xml

I am attaching it as a reference:

<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.0http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>testCase</groupId>
<artifactId>ericsson.com</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>

<name>ericsson.com</name>
<url>http://maven.apache.org</url>

<properties>
<cucumber-jvm.version>1.1.8</cucumber-jvm.version>
<selenium.version>2.42.2</selenium.version>
<junit.version>4.11</junit.version>
</properties>


<build>
<plugins>


<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.3.2</version>
<executions>
<execution>
<phase>integration-test</phase>

<goals>
<goal>java</goal>
</goals>
</execution>
</executions>


<configuration>
<executableDependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-core</artifactId>
</executableDependency>

<mainClass>cucumber.api.cli.Main</mainClass>
<arguments>
<argument>--format</argument>
<argument>junit:output/cucumber-junit-report/allcukes.xml</argument>
<argument>--format</argument>
<argument>pretty</argument>
<argument>--format</argument>
<argument>html:output/cucumber-html-report</argument>
<argument>--format</argument>
<argument>json:output/cucumber_report.json</argument>
<argument>--glue</argument>
<argument>com/</argument>
<argument>src/</argument>

</arguments>
</configuration>

<dependencies>    
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-core</artifactId>
<version>${cucumber-jvm.version}</version>

</dependency>


</dependencies> 







</plugin>
</plugins>

</build>

<dependencies>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-picocontainer</artifactId>
<version>${cucumber-jvm.version}</version>
</dependency>

<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>${cucumber-jvm.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>${selenium.version}</version>

</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-support</artifactId>
<version>${selenium.version}</version>

</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm-deps</artifactId>
<version>1.0.3</version>

</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-html</artifactId>
<version>0.2.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>gherkin</artifactId>
<version>2.12.2</version>

</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>gherkin-jvm-deps</artifactId>
<version>1.0.2</version>

</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>${cucumber-jvm.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.masterthought</groupId>
<artifactId>cucumber-reporting</artifactId>
<version>0.0.23</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>${selenium.version}</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.1.1</version>
</dependency>

</dependencies> 
</project>
Susanta Adhikary
  • 257
  • 2
  • 6
  • 20
  • Please find the stack trace: – Susanta Adhikary Aug 09 '14 at 09:19
  • I am able to figure out the problem. Now When i run the test through maven it is only running the feature file which gives the output as feature unimplemented where as I had already implemented the stepdefinition class. Please let me know how to run the cucumberRunner class. – Susanta Adhikary Aug 09 '14 at 21:56
  • possible duplicate of [Unable to run Cucumber tests from maven](http://stackoverflow.com/questions/25258927/unable-to-run-cucumber-tests-from-maven) – Sled Aug 21 '14 at 00:59
  • You run the Runner class directly from your IDE & selecting run. It looks like you might need to provide the location of your step definition files as the 'glue'. – Marit Jan 04 '18 at 19:32

0 Answers0