![](/img/trans.png)
[英]@RunWith(Cucumber.class) error. The import cucumber.api.junit.Cucumber; cannot be resolved
[英]Cucumber cannot be resolved to a type. @RunWith(Cucumber.class)
我正在嘗試作為maven項目執行,我已經在pom文件和maven依賴項中添加了依賴項,我也可以找到cucumber-junit jar。 但我還是無法導入合適的jar。 獲取" The import cucumber.api.junit cannot be resolved "
。 請找到附帶的屏幕截圖
在maven中添加的依賴性是
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.2.5</version>
<scope>test</scope>
</dependency>
TestRunner類的文件夾結構
你有兩個選擇
1-更改文件夾結構:
src
|
test
|
your-package
|
YourClass
2-您可以從依賴項中刪除范圍測試,如下所示:
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.2.5</version>
</dependency>
你需要這些進口:
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
import org.junit.runner.RunWith;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.