Reputation: 104
I want to run different feature files based and want to decide it at runtime, i.e via command line arguments.
Everytime I uncomment the file and then run the test. Tried working with cucumber tags and did not get around it.
specs: [
// 'features/subscription/create.feature'
// './features/payment/create.feature'
],
Is there any simple way to do this?
Upvotes: 0
Views: 1650
Reputation: 588
There are two ways as far as i know:
suites
with required feature files and pass the suite name as parameter to WDIO test.Detailed explanation on suites: https://webdriver.io/docs/organizingsuites.html
NOTE: In case if you are using npm test
for starting the test, then use npm test -- --suite login
to pick a suite.(this is not mentioned in the file).
In you wdio.conf.js
file write the below lines above the exports.config
and parameter the spec
value.
var features = process.env.FEATURE || './features/**/*.feature';
var featureArray = features.split(',');
exports.config = { .... spec: featureArray, ....} //skipped others
now while triggering the test use the command like below:
FEATURE='./features/test.feature,./features/test1.feature' npm test
So when the execution begins, features
will receive the string and we converted that to array and passing as parameter to spec
.
Hope this helps.
Upvotes: 1