Test class not found in the selected project
I am currently developing a simple program using Cucumber that will check the login of a user on a website.
Here is my TestRunner file:
package cucumberTest;
import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
@RunWith(Cucumber.class)
@CucumberOptions(features = "Feature")
public class TestRunner {
}
I also have a cucumber file as LogIn_Test.feature like this:
Function: Login Action
Scenario: Successful Login with Valid Credentials
Given User is on Home Page
When User Navigate to LogIn Page
And User enters UserName and Password
Then Message displayed Login Successfully
Scenario: Successful LogOut
When User LogOut from the Application
Then Message displayed LogOut Successfully
But whenever I try to run the TestRunner class as a JUnit test, I get the error:
The test class was not found in the selected project.
+3
source to share
2 answers
you should specify the cucumber function file:
@RunWith(Cucumber.class)
@CucumberOptions(features = "classpath:cucumberTest/LogIn_Test.feature")
public class TestRunner {
}
make sure you put it in the resource folder in the same path as the package name, that is: workspace\project-name\src\test\resources\cucumberTest\
+2
source to share