How to execute Multiple cucumber feature files using tags
Asked Answered
H

8

8

I am trying to run multiple feature file using tags, i have tried the command cucumber --tag @some_name --tag @some_name1. But it throws an error which reads as follows,

"WARNING: cannot load such file -- 2.0/gherkin_lexer_en Couldn't load 2.0/gherkin_lexer_en"

Can someone please tell me how to use tags to run multiple feature file.

Hyoscyamus answered 16/6, 2014 at 6:47 Comment(0)
H
19

Example: Running scenarios which match @important OR @billing

cucumber --tags @billing,@important

Example: Running scenarios which match @important AND @billing

cucumber --tags @billing --tags @important

from: https://docs.cucumber.io/cucumber/api/#tags

Henigman answered 13/6, 2017 at 20:41 Comment(0)
M
12

Try this to run multiple feature files using tags

cucumber --tags @some_name,@some_name1,@some_name3
Manon answered 27/6, 2014 at 7:15 Comment(1)
Heaven forbid placing spaces after each comma!Greenery
S
3

Here is the official documentation: https://docs.cucumber.io/cucumber/api/#tags

Shakta answered 30/6, 2014 at 19:21 Comment(0)
M
2

As Eugene Snihovsky said above, to run multiple tags, one at a time (not in parallel).

"--tags=@create-case or @edit-case" worked for me.

I am using VS Code to test cucumber, the full object I used to test within launch.json was as follows:

{
            "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"
            ]
        }

As you can see, the args array stores the --tags arguments.

Moustache answered 5/2, 2020 at 12:54 Comment(0)
B
1

Worked for me

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

If you want to automate your test with gulp-cucumber there is a section tags in the config object, which takes an array of string tags

Barger answered 27/10, 2015 at 11:3 Comment(1)
Hey! So I have a two scenarios marked with @billing @important, and I want only these two scenarios to run and hence I used cucumber --tags @billing --tags @important . When I run it, it doesnt recognize those tags, but when I run just one tag, it runs it. Any idea whyQuincentenary
K
1

cucumber --tags "@tag01 or @tag02" that is in latest documentation and worked for me

Kowatch answered 31/1, 2020 at 11:30 Comment(0)
Z
0

Running Multiple feature file, you need to add tagName into your selected feature file as

A first step to cover your feature file with tagName for example:-

@SmokeTestCases
Feature: Logout module

The second step to go to runner file and add tags into your CucumberOptions Example:-

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

Only those feature files run which is covered with "@SmokeTestCases" tagName

Zahavi answered 18/1, 2019 at 5:11 Comment(0)
P
-1

This is for Java-Cucumber users :: Multiple Features are 1.Smoketest 2. Logintest Then your Junit runner java file should look like

@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#

-- Cheers

Patroclus answered 12/12, 2016 at 16:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.