在cucumber中指定特征文件位置特征、位置、文件、cucumber

由网友(Summer灬浅稚)分享简介:我创建了一些黄瓜测试步骤和一个小黄瓜测试用例,我使用 JUnit 运行如下:I have created some cucumber test steps and a small Cucumber test case, which I run with JUnit like so:@RunWith(Cucumber...

我创建了一些黄瓜测试步骤和一个小黄瓜测试用例,我使用 JUnit 运行如下:

I have created some cucumber test steps and a small Cucumber test case, which I run with JUnit like so:

@RunWith(Cucumber.class)

public class FuelCarTest {
    //executs cucumber steps in the class FuelCarSteps
}

现在从类路径位置自动加载 Cucumber 功能文件,src/main/resources/<package-name>/*.feature

The Cucumber features files are now automatically loaded from the classpath location, src/main/resources/<package-name>/*.feature

我想知道如何告诉 cucumber 我的功能文件的位置,因为我需要它从类路径之外的位置(例如数据//)加载它们.

I could like to know how I can tell cucumber the location of my feature files, because I need it to load them from a location outside the classpath (e.g. data//).

推荐答案

我找到了解决方案,

有@Cucumber.Options注解,在设置报表输出格式和位置的同时,还可以设置特征文件的位置.

there is the @Cucumber.Options annotation, among setting the report output format and location, it also allows setting the location for the feature files.

@Cucumber.Options(
    format = {
        "pretty",
        "html:target/cucumber-html-report",
        "json-pretty:target/cucumber- report.json"
    },
    features="features/"
)
阅读全文

相关推荐

最新文章