Behave - Command Line


Advertisements

Behave has a collection of command line arguments and it can also be outlined from the configuration files. The values set in the configuration files are used automatically, however, it can be overruled by the command line arguments.

Command Line Arguments

Let us discuss some of the command line arguments −

  • –c, --no-color

Impair the usage of the ANSI color escapes.

  • --color -

Utilise the ANSI color escapes. This is an in-built characteristic and can overrule a setting in the configuration file.

  • –d, --dry-run

Summons the formatter without running the steps.

  • -D, --define

Declares the customised information for the config.userdata dictionary.

  • –e, --exclude Pattern

Exclude feature files which are identical to a pattern of regular expression from the execution.

  • –i, --include Pattern

Include feature files which are identical to a pattern of regular expression during the execution.

  • --no-junit

Omit JUnit reports as output.

  • --junit

Add JUnit reports as output. When JUnit is turned on, every stdout and stderr will be a part of the junit report. (Irrespective of the -capture/-no-capture options).

  • –f, --format

Define a formatter. If omitted, the in-built formatter is utilised. The –format-help command shall display all the available formats.

  • -steps-catalog

Displays a catalogue of all the existing step definitions.

  • –k, --no-skipped

Exclude skipped steps from printing in console.

  • no-snippets

Exclude snippets from printing in console for the steps, which are still not implemented.

  • --snippets

Include snippets, while printing in console for the steps which are still not implemented. This is an in-built characteristic and can overrule a configuration file setting.

  • –m, --no-multiline

Exclude multiple lines tables and strings under steps.

  • --multiline

Include multiple lines tables and strings under steps. This is an in-built characteristic and can overrule a configuration file setting.

  • –n, --name

Include the feature elements, which are identical to the specified name in the run. If the option is provided multiple times, it shall match with all the names.

  • --no-capture

Exclude stdout from capturing.

  • --capture

Include stdout. This is an in-built characteristic and can overrule a configuration file setting.

  • --no-capture-stderr

Exclude stderr from capturing.

  • --capture-stderr

Include stderr. This is an in-built characteristic and can overrule a configuration file setting.

  • --no-logcapture

Exclude log from capturing.

  • --logcapture

Include log capturing. Every log for a step will be present and available during the failures. This is an in-built characteristic and can overrule a configuration file setting.

  • --logging-level

Mention the logging level that shall be captured. The default value is INFO.

  • --logging-format

Mention the user-defined format for printing statements. The default value is %(levelname)s:%(name)s:%(message)s.

  • --logging-datefmt

Mention the user-defined date and time format for printing statements.

  • --logging-filter

Mention if the statements are to be filtered or not. All the statements are captured by default. In case the output is too lengthy, we can utilise the option to filter out the unnecessary output.

  • --logging-clear-handlers

Remove all the handlers which are used for logging.

  • --no-summary

Exclude summary post the execution.

  • -summary

Include summary post the execution.

  • –o, --outfile

Write the given file instead of using stdout.

  • –q, --quiet

Alias are used for –no-snippets –no-source.

  • –s, --no-source

Exclude printing the file and the line of step definition along with steps.

  • --show-source

Include printing the file and the line of step definition along with the steps. This is an in-built characteristic and can overrule a configuration file setting.

  • --stage

Describes the present stage of the test. The stage name is utilised as the name affix for the environment file, along with the directory for the steps.
  • --stop

Terminate executing tests after encountering the first failure.

  • –t, --tags

Include the features/scenarios having tags, which are identical to TAG_EXPRESSION in the execution.

  • –T, --no-timings

Exclude printing duration of execution for each step.

  • --show-timings

Capture the duration taken by each step to complete in seconds in the console. This is an in-built characteristic and can overrule a configuration file setting.

  • –v, --verbose

Displays the loaded features and files.

  • –w, --wip

Execute the scenarios having the wip tag. Moreover, we have to use the plain formatter and not record the stdout or log output and terminate post first failure.

  • –x, --expand

Flatten the table of Scenario Outline in output.

  • --lang

Utilise keywords for a language except English.

  • --lang-list

Displays all the languages present in –lang.

  • --lang-help

Displays all the translations acquired for a single language.

  • --tags-help

Display help for tag statements.

  • --version

Displays version.

  • junit –directory

This is the directory location where the Junit reports are stored.

  • --show-skipped

Include skipped steps while printing in console. This is an in-built characteristic and can overrule a configuration file setting.

Advertisements