'How do i run 'tagged' scenarios with Cucumber tags in WebdriverIO
Hi _ if anyone can help here- I am trying to run a specific scenario by using Cucumber tags- this is the expression i am using to run the tests built with Webdriver- Cucumber framework-
npx wdio run wdio.conf.js --cucumberOpts.tagExpression='@Tag
When I use the above, nothing happens - i have defined the tag - '@Tag' at the feature level- so am expecting that all the scenarios within the feature file will get executed, however when i run the above command- nothing happens. Can someone please help?
Solution 1:[1]
If you want to run only specific tests you can mark your features with tags. These tags will be placed before each feature like so:
@sanity
Feature: checking for sanity test
Scenario:
Given
When:
Then:
To run only the tests with specific tag(s) use the --cucumberOpts.tagExpression= parameter like:
wdio -- --cucumberOpts.tagExpression='@sanity'
wdio -- --cucumberOpts.tagExpression='@sanity or @AnotherTag'
Could not exactly predict issue you facing with the info you provided. I would suggest to have a look on the cucumber tag documentation and webderiverio testsuite implementation documentation.
I hope it helps, Happy Learning !!
Solution 2:[2]
I got it working having in package.json"scripts": { "test": "wdio ./wdio.conf.js --cucumberOpts.tagExpression" }
and running the test usingnpm run test "@Tag"
Solution 3:[3]
use as below
"test-imagesave": "wdio run 'config/wdio.conf.ts' --cucumberOpts.tagExpression '@tag'",
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | David Sanchez Garcia |
| Solution 3 | Leena Nikhar |
