我的黄瓜功能如下所示: 功能:登录操作
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
当我运行它时,我收到以下错误:
警告:不推荐使用Cucumber-JVM的--format选项。请用 - 改为--plugin。线程“main”中的异常java.lang.IllegalArgumentException:不是文件或目录: C:\ Users \ testjack001 \ workspace \ myProject \ src \ myFeature.feature at cucumber.runtime.io.FileResourceIterator $ FileIterator。(FileResourceIterator.java:54) 在 cucumber.runtime.io.FileResourceIterator。(FileResourceIterator.java:20) 在 cucumber.runtime.io.FileResourceIterable.iterator(FileResourceIterable.java:19) 在 cucumber.runtime.model.CucumberFeature.loadFromFeaturePath(CucumberFeature.java:101) 在 cucumber.runtime.model.CucumberFeature.load(CucumberFeature.java:54) 在 cucumber.runtime.model.CucumberFeature.load(CucumberFeature.java:34) 在 cucumber.runtime.RuntimeOptions.cucumberFeatures(RuntimeOptions.java:201) 在cucumber.runtime.Runtime.run(Runtime.java:109)at cucumber.api.cli.Main.run(Main.java:36)at cucumber.api.cli.Main.main(Main.java:18)
如何解决此问题?
答案 0 :(得分:1)
关于--format选项的条目只是一个警告,它不是错误。您的错误从下一行开始:
线程中的异常" main" java.lang.IllegalArgumentException:不是文件或目录:C:\ Users \ testjack001 \ workspace \ myProject \ src \ myFeature.feature
Cucumber无法在您希望放置的位置找到您的要素文件。
答案 1 :(得分:0)
将您的pom.xml依赖项更新为黄瓜版本1.2.3
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-picocontainer</artifactId>
<version>1.2.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.2.3</version>
<scope>test</scope>
</dependency>
</dependencies>