Command Line Options
Behave is driven from the command line: behave [options] [paths...]. If no paths are given it looks for a features directory. The options cover test selection, output formatting, and run behavior, and they all combine freely with a behave.ini configuration file.
Selection Options
These options decide which features and scenarios run:
behave features/ # run everything under features/
behave features/cart features/faq # run only these paths
behave -t @smoke features/ # tag expression
behave -t "@smoke and not @flaky"
behave -n "Withdraw money" # exact scenario name
behave -i "login" features/ # include: name regex
behave -e "legacy export" features/ # exclude: name regex
behave -D features/ # dry run: match steps, execute nothing
Output Options
The -f / --format and -o / --output options control reporting. Repeat the pair to produce multiple formats in one run:
# console stays pretty, files go to reports/
behave -f html -o reports -f junit -o reports -f json -o reports
# progress bar on the console
behave -f progress
Run Behavior Options
A few options change how the runner itself behaves:
behave -s features/ # show the source line of each step
behave -v features/ # verbose mode (detailed error output)
behave --no-capture # do not swallow stdout/stderr of steps
behave -w features # set the working directory explicitly
behave -l id features/ # run feature files in another Gherkin language
behave -V # print the behave version
Reading the Exit Code
The process exits with a non-zero status when any scenario fails, which is what CI systems key on. A run that is fully green exits with 0, so a wrapper script can simply propagate the return value.
Summary
Behave's command line splits into selection (paths, tags, names), output (formats and destinations), and run behavior (dry run, source display, language). Combine them as needed, and persist the stable parts in behave.ini.