Exclude execution of feature file in Behave BDD

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!

Share On

Share on facebook
Share on twitter
Share on linkedin
Share on whatsapp
Share on tumblr
Share on email

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top

Lifetime Membership Club

LIFETIME MEMBERSHIP BIG SALE - ALL LIVE COURES JUST - 10000 RS/149 USD
Attend All Live courses in just 10000 rs / $149 - offer ends 31st May 2024