In behave, how do you run a scenario only?

Mark Lopez picture Mark Lopez · Nov 20, 2014 · Viewed 20k times · Source

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)

Answer

Louis picture Louis · Aug 21, 2015

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.