scenario.scenariologging module

Scenario logging.

SCENARIO_LOGGING

Main instance of ScenarioLogging.

class ScenarioLogging

Bases: object

Scenario logging management.

ACTION_RESULT_MARGIN = 12

Actions, expected results and evidence lines are right-aligned with the longest ‘EVIDENCE: ‘ pattern.

SCENARIO_STACK_INDENTATION_PATTERN = '      | '

The scenario stack indentation pattern ensures that the ‘|’ lines are presented the ‘ACTION: ‘ or ‘RESULT: ‘ pattern they relate to.

class _Call

Bases: StrEnum

ScenarioLogging call identifiers.

BEGIN_SCENARIO = 'beginscenario'
BEGIN_ATTRIBUTES = 'beginattributes'
ATTRIBUTE = 'attribute'
END_ATTRIBUTES = 'endattributes'
STEP_DESCRIPTION = 'stepdescription'
ACTION = 'action'
RESULT = 'result'
END_SCENARIO = 'endscenario'
__init__()

Initializes the last call history.

_calls

History of this class’s method calls.

Makes it possible to adjust the display depending on the sequence of information.

_known_issues

Known issues already displayed.

beginscenario(scenario_definition)

Displays the beginning of a scenario execution.

Parameters:

scenario_definition – Scenario being executed.

beginattributes()

Marks the beginning of scenario attributes.

attribute(name, value)

Display the value of a scenario attribute.

Parameters:
  • name – Scenario attribute name.

  • value – Scenario attribute value.

endattributes()

Marks the end of scenario attributes, and the beginning of the test steps by the way.

stepsection(step_section)

Displays a step section.

Parameters:

step_section

Returns:

stepdescription(step_definition)

Displays a step being executed.

Parameters:

step_definition – Step definition being executed.

actionresult(actionresult, description)

Displays an action or an expected result being executed.

Parameters:
  • actionresult – Action or expected result being executed.

  • description – Action/result description.

error(error)

Displays the test exception.

Parameters:

error – Error to display.

evidence(evidence)

Displays an evidence.

Evidence being saved with the test results shall also be printed out in the console.

Parameters:

evidence – Evidence text.

endscenario(scenario_definition)

Displays the end of a scenario execution.

Parameters:

scenario_definition – Scenario which execution has just finished.

Resets the _known_issues history for the main scenario.

displaystatistics(scenario_execution)

Displays the scenario statistics.

Parameters:

scenario_execution – Scenario which execution has just finished.