English 中文(简体)
Behave - Configuration Files
  • 时间:2024-12-22

Behave - Configuration Files


Previous Page Next Page  

Behave configuration files are known as the .behaverc/behave.ini/setup.cfg/tox.ini(any one 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

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

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

Utipse 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 customised data for the config.userdata 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 utipsed. The –format-help command shall display all the available formats.

    steps_catalog − bool

Displays a catalogue of all the existing step definitions.

    scenario_outpne_annotation_schema: text

Mention annotation schema for scenario outpne.

    show_skipped − bool

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

    show_snippets − bool

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.

    show_multipne − bool

Include multiple pnes 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 utipse 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

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

    show-source − bool

Include printing the file and the pne 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 utipsed 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 which 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 Outpne in output.

    lang − text

Utipse keywords for a language except Engpsh.

Advertisements