Tutorial 16 – Exclude execution of feature file in Behave BDD
Welcome to the 16th article in Behave BDD series!
What you will Learn :
‘behave’ command to execute all features
How to exclude a feature from execution
behave command to execute all features
So far we have been executing one feature file at a time. Let us now see how to execute all the features using a single command.
If you notice below, we have 5 feature files. We want to execute all of them using a single command
Let’s go to the terminal and run dir command. You should see 5 feature files as expected
Notice below, we just need to exeucte behave command. It will pick up all the feature files automatically
Notice above that 5 features were executed.
How to exclude a feature from execution
Now suppose we want to exclude a feature file from execution. Let us see how to do that.
Execute the below command
Notice above that we can either use -e OR --exclude.
See below, we are using -e to exclude
Notice above that 4 features were executed (out of total 5). Login.feature was excluded from execution.
Similarly we can use --exclude to exclude a feature, see below
So this is how we exclude the feature files from execution.
Thank you for reading!