我已经创建了一些黄瓜测试步骤和一个小黄瓜测试用例[1],我使用junit运行,如下所示:
@RunWith(Cucumber.class)
public class FuelCarTest {
//executs cucumber steps in the class FuelCarSteps
}
Run Code Online (Sandbox Code Playgroud)
黄瓜特征文件现在从类路径位置自动加载 src/main/resources/<package-name>/*.feature
我想知道如何告诉黄瓜我的功能文件的位置,因为我需要它从类路径之外的位置加载它们(例如数据//).
我试图在类似UNIX的系统上用Maven运行Cucumber(不幸的是,我不得不使用Windows,尽管cmd.exe具有相同的结果)命令行:
mvn clean test -Dcucumber.options="src/test/resources/com/example/sqa/automation_cuke/pages/sample_test.feature"
结果是:
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
...
[INFO] --- exec-maven-plugin:1.2.1:java (default) @ sqa.automation_cuke ---
Feature: My animals Sample
Sample test to use as basis for conversion
Scenario: My animals # sample_test.feature:4
Given that I have my animals
1 Scenarios (1 undefined)
1 Steps (1 undefined)
0m0.000s
You can implement missing steps with the snippets below:
@Given("^that I have my animals$")
public void that_I_have_my_animals() throws Throwable {
// Write code …Run Code Online (Sandbox Code Playgroud)