Search code examples
seleniumintellij-ideajunitcucumbercucumber-junit

Getting org.junit.runner.RunWith is not an annotation type with Cucumber


I'm trying to set-up a Selenium + Cucumber project in Java (I'm a beginner with Java) in Intellij. This is my class that uses the Cucumber JUnit runner:

package runtest;

import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
import org.junit.runner.RunWith;

@RunWith(Cucumber.class)
@CucumberOptions (
        features = "C:\\Users\\my-feature.feature",
)

public class RunTest {

}

I'm getting these errors:

Error:(8, 1) java: annotation @org.junit.runner.RunWith is missing default values for elements annotationType,<init>
Error:(8, 2) java: org.junit.runner.RunWith is not an annotation type

I don't know how to resolve this or what is happening. Please help.


Solution

  • I had multiple RunWith classes in my project path. After pruning the project tree, it works as expected.