Selenium 获取org.junit.runner.RunWith不是具有Cucumber的注释类型
我正试图在Intellij中用Java(我是Java初学者)建立一个Selenium+Cucumber项目。这是我使用Cucumber JUnit runner的类:Selenium 获取org.junit.runner.RunWith不是具有Cucumber的注释类型,selenium,intellij-idea,junit,cucumber,cucumber-junit,Selenium,Intellij Idea,Junit,Cucumber,Cucumber Junit,我正试图在Intellij中用Java(我是Java初学者)建立一个Selenium+Cucumber项目。这是我使用Cucumber JUnit runner的类: package runtest; import cucumber.api.CucumberOptions; import cucumber.api.junit.Cucumber; import org.junit.runner.RunWith; @RunWith(Cucumber.class) @CucumberOptions
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 {
}
我发现以下错误:
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
错误:(8,1)java:annotation@org.junit.runner.RunWith缺少元素annotationType的默认值,
错误:(8,2)java:org.junit.runner.RunWith不是注释类型
我不知道如何解决这个问题,也不知道发生了什么。请提供帮助。如果选择将要素文件放置在项目空间中,则不必提供该要素文件的绝对路径。功能文件文件夹的名称就足够了 例如,如果您具有以下结构:
- 套餐:Q43966680
- 班级:跑步者
- 要素文件文件夹:q43966680
@CucumberOptions
中的用例,您只需提及:
@RunWith(Cucumber.class)
@Cucumber.Options (features="q43966680")
public class RunTest {
}
我的项目路径中有多个
RunWith
类。修剪项目树后,它会按预期工作。您是否使用pom.xml
不,我没有使用它。谢谢,这很有用,但它没有回答我的问题。