在cucumber中指定特征文件位置 [英] Specify the feature file location in cucumber

查看:28
本文介绍了在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/"
)

这篇关于在cucumber中指定特征文件位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆