如何更新 Cucumber-JVM 的 --format 选项?
How to update Cucumber-JVM's --format option?
我的 Cucumber 功能如下所示:
功能:登录操作
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
当我 运行 它时,出现以下错误:
WARNING: Cucumber-JVM's --format option is deprecated. Please use
--plugin instead. Exception in thread "main" java.lang.IllegalArgumentException: Not a file or directory:
C:\Users\testjack001\workspace\myProject\src\myFeature.feature at
cucumber.runtime.io.FileResourceIterator$FileIterator.(FileResourceIterator.java:54)
at
cucumber.runtime.io.FileResourceIterator.(FileResourceIterator.java:20)
at
cucumber.runtime.io.FileResourceIterable.iterator(FileResourceIterable.java:19)
at
cucumber.runtime.model.CucumberFeature.loadFromFeaturePath(CucumberFeature.java:101)
at
cucumber.runtime.model.CucumberFeature.load(CucumberFeature.java:54)
at
cucumber.runtime.model.CucumberFeature.load(CucumberFeature.java:34)
at
cucumber.runtime.RuntimeOptions.cucumberFeatures(RuntimeOptions.java:201)
at 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)
如何解决这个问题?
关于 --format 选项的条目只是一个警告,不是错误。您的错误从下一行开始:
Exception in thread "main" java.lang.IllegalArgumentException: Not a file or directory: C:\Users\testjack001\workspace\myProject\src\myFeature.feature
Cucumber 无法在它希望放置的位置找到您的特征文件。
将您的 pom.xml 依赖项更新为 Cucumber 版本 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>
我的 Cucumber 功能如下所示: 功能:登录操作
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
当我 运行 它时,出现以下错误:
WARNING: Cucumber-JVM's --format option is deprecated. Please use --plugin instead. Exception in thread "main" java.lang.IllegalArgumentException: Not a file or directory: C:\Users\testjack001\workspace\myProject\src\myFeature.feature at cucumber.runtime.io.FileResourceIterator$FileIterator.(FileResourceIterator.java:54) at cucumber.runtime.io.FileResourceIterator.(FileResourceIterator.java:20) at cucumber.runtime.io.FileResourceIterable.iterator(FileResourceIterable.java:19) at cucumber.runtime.model.CucumberFeature.loadFromFeaturePath(CucumberFeature.java:101) at cucumber.runtime.model.CucumberFeature.load(CucumberFeature.java:54) at cucumber.runtime.model.CucumberFeature.load(CucumberFeature.java:34) at cucumber.runtime.RuntimeOptions.cucumberFeatures(RuntimeOptions.java:201) at 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)
如何解决这个问题?
关于 --format 选项的条目只是一个警告,不是错误。您的错误从下一行开始:
Exception in thread "main" java.lang.IllegalArgumentException: Not a file or directory: C:\Users\testjack001\workspace\myProject\src\myFeature.feature
Cucumber 无法在它希望放置的位置找到您的特征文件。
将您的 pom.xml 依赖项更新为 Cucumber 版本 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>