Cucumber tests are not getting executed by maven, "No tests to run."
See original GitHub issueSummary
Tests are not getting executed by maven, but those are getting executed by runner file
Expected Behavior
Cucumber feature files should be executed by maven
Current Behavior
Maven console is showing no tests to run
Steps to Reproduce (for bugs)
- Download the file from https://drive.google.com/open?id=0B4SgyzyvwKhiTF9SZG96eDBNT1U
- Run the project as maven test
- Features files are not getting executed by Maven
Your Environment
MacOS Selenium 3.4.0 Cucumber 1.2.5 Runner file as below
@RunWith(Cucumber.class)
@CucumberOptions(
features = {"classpath:features"},
plugin = {"pretty", "html:target/cucumber-html-report","json:target/cucumber.json"},
tags = {"@tag1"},
glue={"helpers","stepDefinitions"},
// dryRun = true,
monochrome = true
)
public class RunCukesTest{
}
Pom file
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>simplify360Cucumber</groupId>
<artifactId>s360UIAutomation</artifactId>
<version>0.0.1</version>
<packaging>jar</packaging>
<name>Cucumber-JVM template</name>
<dependencies>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-testng</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm</artifactId>
<version>1.2.5</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.4.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-firefox-driver</artifactId>
<version>3.4.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>htmlunit-driver</artifactId>
<version>2.24</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>net.masterthought</groupId>
<artifactId>cucumber-reporting</artifactId>
<version>3.7.0</version>
</dependency>
<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports</artifactId>
<version>3.0.6</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.16</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.16</version>
</dependency>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.8.0</version>
</dependency>
<!-- <dependency> <groupId>org.apache.maven.surefire</groupId> <artifactId>surefire-junit</artifactId>
<version>2.6</version> </dependency> -->
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20</version>
<configuration>
<!-- <testClassesDirectory>s360UIAutomationCC/src/main/java</testClassesDirectory> -->
<testSourceDirectory>s360UIAutomationCC/src/main/java</testSourceDirectory>
<includes>
<include>**/*RunCukesTest.java</include>
</includes>
<!-- <excludes> <exclude>**/*RunCukesTest.java</exclude> </excludes> -->
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
`
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Maven not running cucumber tests - java - Stack Overflow
I was facing the same issue with Junit 5.5.2 and maven 3.6. The tests run fine from IntelliJ but maven does not run...
Read more >Re: [Cucumber] Tests not getting picked up while running from ...
Whereas test cases are not getting picked up for run while running the Test Runner class from command prompt. It always shows the...
Read more >Maven Surefire Plugin – Skipping Tests
To skip running the tests for a particular project, ... You can also skip the tests via the command line by executing the...
Read more >Maven Surefire Plugin – Running a Single Test
During development, you may run a single test class repeatedly. To run this through Maven, set the test property to a specific test...
Read more >Maven Surefire Plugin – surefire:test - Apache Maven
By default, Surefire does not execute tests in parallel. ... tests and interrupt currently running tests after a certain number of seconds.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@brasmusson i have tried few options like giving path for test directory etc like below
Is there any error in the configuration or do i have to move the runner file to
src/test/java
@nagarjun64 Maven expects test code to live under
src/test/<language>/
, by puttingRunCukesTest.java
undersrc/main/java
you are saying to maven “this is not a test class”, try and moveRunCukesTest.java
tosrc/test/java
.If you still have problem, first clone and build https://github.com/cucumber/cucumber-java-skeleton to get a working example that you can use as template.