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
Pingback: Behave - Command Line - Adglob Infosystem Pvt Ltd
Thanks for sharing, this is a fantastic post.Thanks Again. Awesome.