如何使用标签执行多个黄瓜功能文件

时间:2014-06-16 06:47:53

标签: cucumber watir-webdriver

我正在尝试使用标签运行多个功能文件,我尝试过命令cucumber --tag @some_name --tag @ some_name1。但它会抛出一个错误,如下所示,

“警告:无法加载此类文件 - 2.0 / gherkin_lexer_en 无法加载2.0 / gherkin_lexer_en“

有人可以告诉我如何使用标签来运行多个功能文件。

8 个答案:

答案 0 :(得分:8)

尝试使用标记

运行多个要素文件
cucumber --tags @some_name,@some_name1,@some_name3

答案 1 :(得分:5)

示例:运行与@important OR @billing

匹配的方案
cucumber --tags @billing,@important

示例:运行与@important AND @billing

匹配的方案
cucumber --tags @billing --tags @important

来自:https://docs.cucumber.io/cucumber/api/#tags

答案 2 :(得分:3)

答案 3 :(得分:1)

为我工作

cucumber --tags @some_name --tags @some_name1 --tags @some_name3

如果您想使用gulp-cucumber自动化测试 在配置对象中有一个标记部分,其中包含数组的字符串标记

答案 4 :(得分:1)

黄瓜--tags“ @ tag01或@ tag02” 最新文档中的内容对我有用

答案 5 :(得分:1)

如上所述Eugene Snihovsky,一次运行多个标签(一次不并行)。

"--tags=@create-case or @edit-case"为我工作。

我正在使用VS Code测试黄瓜,我曾经在launch.json中测试的完整对象如下:

{
            "name": "Cucumber @create-case",
            "type": "node",
            "console": "integratedTerminal",
            "request": "launch",
            "program": "${workspaceFolder}/tests/cucumberjs/node_modules/cucumber/bin/cucumber-js",
            "cwd": "${workspaceFolder}/tests/cucumberjs",
            "args": [
                "--tags=@create-case or @edit-case",
                "--format=node_modules/cucumber-pretty"
            ]
        }

如您所见,args数组存储--tags自变量。

答案 6 :(得分:0)

正在运行多个功能文件,您需要以

的方式将tagName添加到所选功能文件中

使用tagName覆盖功能文件的第一步,例如:-

@SmokeTestCases
Feature: Logout module

第二步转到运行程序文件并将标签添加到您的CucumberOptions示例中:-

@CucumberOptions(plugin = { "pretty" },
    features = { "features" },
    glue = { "stepdefs" },
    tags = { "@SmokeTestCases" })

仅运行那些由“ @SmokeTestCases”标记名覆盖的功能文件

答案 7 :(得分:-1)

这适用于Java-Cucumber用户::多个功能是1.Smoketest 2. Logintest那么你的Junit runner java文件看起来应该是

@RunWith(Cucumber.class)    
@CucumberOptions 
(features = "src/test/java/testStep/",#Path for the Feature files Folder. Given you have smoke.feature and login.feature files present in the Path#
        plugin ={"pretty","html:reports/test-report"},#Path for the Reports Html Folder#
        tags= {"@smoke" ,"@login"})#Declaring multiple Feature names of files#

- 干杯

相关问题