Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In behave, how do you run a scenario only?

I have a 'behave' feature that has a lot of tests on it.

I only need to run a specific scenario for development needs.

How do I do it?

(preferably on the command line)

like image 483
Mark Lopez Avatar asked Nov 20 '14 01:11

Mark Lopez


People also ask

How do you run a specific scenario in behave?

You can run a feature file by using -i or --include flags and then the name of the feature file. For more information check the documentation for command line arguments. There's a lot of useful information hidden in their appendix section. NOTE: At the time I'm writing this it won't work with Python 3.6 and Behave 1.2.

What is a scenario in behave?

Advertisements. A Scenario Outline is used if we have a group of similar criteria and the results are to be passed in a Scenario. A Scenario Outline is accompanied with an Examples table. A Scenario Outline can have multiple Examples tables.


1 Answers

To run only a single scenario you can use -n with the name of the scenario:

$ behave -n 'clicking the button "foo" should bar the baz' 

I'm using single quotes above to keep the name of the scenario as one argument for -n. Otherwise, the shell will pass each word of the scenario name as a separate argument.

like image 199
Louis Avatar answered Sep 22 '22 11:09

Louis