Architecture

Scenario execution

The ScenarioDefinition, StepDefinition and ActionResultDefinition classes are the base classes for the definition of scenarios, steps, actions and expected results respectively.

The ScenarioRunner instance handles the execution of them.

Its ScenarioRunner.main() method is the entry point that a launcher script should call. This method:

  1. analyzes the command line arguments and loads the configuration files (see the related design section),

  2. builds a scenario instance from the given scenario script, with reflexive programming,

  3. proceeds with the scenario execution.

The ScenarioRunner class works with a couple of helper classes.

The ScenarioExecution, StepExecution and ActionResultExecution classes store the execution information related to definition classes cited above.

Definition v/s execution classes

Definition

Execution

Scenario level

ScenarioDefinition

ScenarioExecution

  • Tells which step is currently being executed.

  • Stores the execution error, if any.

  • Stores execution statistics.

  • Gives access to the related ScenarioDefinition instance.

Step level

StepDefinition

StepExecution

  • Tells wich action or expected result is currently being executed.

  • Stores the execution error, if any.

  • Stores execution statistics.

  • Gives access to the related StepDefinition instance.

Action and expected result level

ActionResultDefinition

  • Describes an action or an expected result, with its text.

  • Gives the related ActionResultExecution instances when executed.

ActionResultExecution

Note

Due to the goto feature, steps, actions and expected results may be executed several times within a single scenario execution.

The ScenarioStack also is a helper class for ScenarioRunner:

  • It stores the current stack of scenarios being executed (see sub-scenarios.

  • It also provides a couple of accessors to the current step, action or expected result being executed.

The ScenarioRunner class remains the conductor of all:

  1. The ScenarioRunner.main() method is called.

  2. For each script path given in the command line:

    1. A main ScenarioDefinition instance is created [2] from the scenario class in the script [8]. A ScenarioExecution instance is created as well, and pushed to the ScenarioStack instance [4].

    2. ScenarioRunner._execution_mode is set to ScenarioRunner.ExecutionMode.BUILD_OBJECTS:

      1. In case the steps are defined with step...() methods, the ScenarioDefinition is fed using reflexive programmation (the same for scenario attributes defined with class members) [4] [8].

      2. Each step is executed a first time [4] [5] in order to build its ActionResultDefinition instances for each StepUserApi.ACTION() and StepUserApi.RESULT() call [6]. During this first execution of the step, the two latter methods return False [1], which prevents the test from being executed at this point.

    3. ScenarioRunner._execution_mode is set to ScenarioRunner.ExecutionMode.EXECUTE or ScenarioRunner.ExecutionMode.DOC_ONLY [3]. For each step [3] [5]:

      1. A StepExecution instance is created [5].

      2. The user test code is called [5].

      3. For each StepUserApi.ACTION() and StepUserApi.RESULT() call [6]:

        1. A ActionResultExecution instance is created [6].

        2. If a sub-scenario is executed, then it is pushed to the ScenarioStack instance [4], built [4] [8] [5], executed [3] [5], and eventually popped from the ScenarioStack instance [7].

    4. The main scenario is eventually popped from the ScenarioStack instance [7].

  3. If there were several scenarios executed, the final results are displayed [9].

Subscenarios

Todo

Documentation needed: Architecture - Subscenarios

Assertions, error management & execution locations

Todo

Documentation needed: Architecture - Error management

Campaign execution

Todo

Documentation needed: Architecture - Campaign execution

  • CampaignRunner

  • CampaignExecution, TestSuiteExecution, TestCaseExecution classes.

  • Test suite files.

  • Test cases executed in separate processes.

Logging

Todo

Documentation needed: Architecture - Logging

Configuration

Todo

Documentation needed: Architecture - Configuration

Path management

Todo

Documentation needed: Architecture - Path