scenario.scenarioexecution module

Scenario execution management.

class ScenarioExecution

Bases: object

Object that gathers execution information for a scenario.

The scenario execution information is not stored in the base ScenarioDefinition class for user scenario definitions. In order to avoid confusion, the dedicated members and methods are implemented in a separate class: ScenarioExecution.

__init__(definition)
Parameters:

definition – Related scenario definition under execution. May be None when the ScenarioExecution instance is created as a data container only.

definition

Related scenario definition.

__current_step_definition

Current step reference in the scenario step list.

__next_step_definition

Next step reference in the step list. Used when a scenariodefinition.ScenarioDefinition.goto() call has been made.

time

Time statistics.

errors

Errors.

warnings

Warnings.

_logger

Make this class log as if it was part of the ScenarioRunner execution.

__repr__()

Canonical string representation.

startsteplist()

Initializes the step iterator.

Once the step iterator has been initialized, the current_step_definition attribute gives the current step. If the scenario has no step of the kind, current_step_definition is None as a result.

The nextstep() method then moves the iterator forward.

nextstep()

Moves the step iterator forward.

Returns:

True when a next step is ready, False otherwise.

When nextstep() returns False, the current_step_definition is None as a result.

setnextstep(step_definition)

Arbitrary sets the next step for the step iterator.

Useful for the goto feature.

Parameters:

step_definition – Next step definition to execute.

property current_step_definition

Current step definition being executed.

Depends on the current active step iterator (see backtosteptype()).

property status

Scenario execution status.

ExecutionStatus.FAIL when an exception is set, ExecutionStatus.SUCCESS otherwise.

Returns:

Scenario execution status.

property step_stats

Step statistics computation.

Returns:

Number of steps executed over the number of steps defined.

property action_stats

Action statistics computation.

Returns:

Number of actions executed over the number of actions defined.

property result_stats

Expected result statistics computation.

Returns:

Number of expected results executed over the number of expected results defined.

__cmp(other)

Scenario execution comparison in terms of result criticity.

Parameters:

other – Other ScenarioExecution instance to compare with.

Returns:

  • -1 if self is less critical than other,

  • 0 if self and other have the same criticity,

  • 1 if self is more critical than other.

__lt__(other)

Checks whether self < other, i.e. self strictly less critical than other.

__le__(other)

Checks whether self <= other, i.e. self less critical than or as critical as``other``.

__gt__(other)

Checks whether self > other, i.e. self strictly more critical than other.

__ge__(other)

Checks whether self >= other, i.e. self more critical than or as critical as``other``.