0

I'm struggling with running behave features using below command:

behave feature_name_1 feature_name_2

I would like to run a few features in one command giving only feature's name or feature's name.feature. For now, I have to indicate the whole path where the feature is.

etrupja
  • 2,710
  • 6
  • 22
  • 37
Iwona
  • 83
  • 1
  • 5

1 Answers1

0

Use -i or --include.

behave -i myfeature.feature

This can also be used with patterns.

Alternatively use -n to match the names of your files:

behave -n myfeature1.feature -n myfeature2.feature

From the documentation:

n, --name

Only execute the feature elements which match part of the given name. If this option is given more than once, it will match against all the given names.

More information on running particular scenarios, etc. can be found in this similar question; documentation here.

Lunivore
  • 17,277
  • 4
  • 47
  • 92
  • behave -i or even with --include still doesn't work. ConfigError: No steps directory is displayed – Iwona Mar 02 '20 at 09:55
  • Please include a bit more info in the question. What have you tried that works? What's the difference between that, and what doesn't work? What happens if you use the `--verbose` arg? – Lunivore Mar 04 '20 at 23:36
  • Does it work with just one feature? If so please try what @manzanero proposed - use -i between each feature name. – Lunivore Mar 04 '20 at 23:37
  • yes, it works just for one feature. When I use -i between each feature name it will run only second feature. On example: `behave -i myfeature.feature -i myfeature2.feature` - only myfeature2.feature will be launched – Iwona Mar 06 '20 at 06:46
  • So I've taken the 2nd one out of my answer; thanks for letting me know. Have you tried using glob or regex patterns with -i? I don't have a copy of the software to hand to try it out. What happens when you try it with two and you use --verbose? Please also try -n with multiple feature names `-n featureone.feature -n feature2.feature` as that matches names rather than patterns. – Lunivore Mar 09 '20 at 08:32