Behave – Configuration Files

Behave - Configuration Files

Behave configuration files are known as theΒ .behaverc/behave.ini/setup.cfg/tox.ini(anyone and is set as per user choice).

The files can be located in the following places βˆ’

  • The present working directory.
  • User home directory.
  • For Windows users, in the directory %APPDATA%.

The commandΒ behave –v shall display all the configuration details. The configuration files should begin with the keyword [behave] and follow Windows INI style format.

For example,

[behave]
format = plain
dry_run = false

Types of Parameters in Behave Configuration Files

Types of configuration parameters in Behave include the following βˆ’

  • Text βˆ’ To assign a text to the configuration setting.
  • Bool βˆ’ Assigns Boolean value to the configuration setting. The text defines the behaviour (true values include 1, true, yes, and on). The false values include 0, false, no, and off).
  • Sequence<text> βˆ’ To accept multiple values on new lines.

For example, tag expression can be as follows βˆ’

tags=@a, ~@b
         @c

This is equivalent to the following tag expression βˆ’

--tags @a, ~@b --tags @c

Configuration Parameters

Some of the configuration parameters in Behave are explained below βˆ’

  • color βˆ’ bool

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

  • dry_run βˆ’ bool

Calls the formatters without running the steps.

  • userdata_defines βˆ’ sequence<text>

Declares the customized data for the config. user-data dictionary.

  • exclude_re βˆ’ text

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

  • include_re βˆ’ text

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

  • junit βˆ’ bool

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).

  • junit_directory βˆ’ text

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

  • default_format βˆ’ text

Declare default formatter. The default value is pretty.

  • format: sequence<text>

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

  • steps_catalog βˆ’ bool

Displays a catalog of all the existing step definitions.

  • scenario_outline_annotation_schema: text

Mention annotation schema for scenario outline.

  • show_skipped βˆ’ bool

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

  • show_snippets βˆ’ bool

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

  • show_multiline βˆ’ bool

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

  • name βˆ’ sequence<text>

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

  • stdout_capture βˆ’ bool

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

  • stderr_capture βˆ’ bool

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

  • log_capture βˆ’ bool

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 βˆ’ text

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

  • logging_format βˆ’ text

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

  • logging_datefmt βˆ’ text

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

  • logging_filter βˆ’ text

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

  • logging_clear_handlers : bool

Remove all the handlers which are used for logging.

  • summary βˆ’ bool

Include a summary post the execution.

  • outfiles βˆ’ sequence<text>

Write the given file instead of using stdout.

  • paths βˆ’ sequence<text>

Mention the default paths of feature files.

  • quiet βˆ’ bool

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

  • show-source βˆ’ bool

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

  • stage βˆ’ text

Describes the present stage of the test. The stage name is utilized as the name affix for the environment file along with the directory for steps.

  • stop βˆ’ bool

Terminate executing tests after encountering the first failure.

  • tags βˆ’ sequence<text>

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

  • default_tags βˆ’ text

Declare the default tags if they are not given.

  • show_timings βˆ’ bool

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.

  • verbose βˆ’ bool

Displays the loaded features and files.

  • wip βˆ’ bool

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.

  • expand βˆ’ bool

Flatten the table of Scenario Outline in output.

  • lang βˆ’ text

Utilize keywords for a language except for English.

Next Topic – Click Here

This Post Has 2 Comments

Leave a Reply