question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cucumber tests are not getting executed by maven, "No tests to run."

See original GitHub issue

Summary

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)

  1. Download the file from https://drive.google.com/open?id=0B4SgyzyvwKhiTF9SZG96eDBNT1U
  2. Run the project as maven test
  3. 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>

` screen shot 2017-06-03 at 7 00 38 pm

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
nagarjun64commented, Jun 5, 2017

@brasmusson i have tried few options like giving path for test directory etc like below

<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>

Is there any error in the configuration or do i have to move the runner file to src/test/java

1reaction
brasmussoncommented, Jun 4, 2017

@nagarjun64 Maven expects test code to live under src/test/<language>/, by putting RunCukesTest.java under src/main/java you are saying to maven “this is not a test class”, try and move RunCukesTest.java to src/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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found