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:
analyzes the command line arguments and loads the configuration files (see the related design section),
builds a scenario instance from the given scenario script, with reflexive programming,
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 |
Execution |
|
|---|---|---|
Scenario level |
|
|
Step level |
|
|
Action and expected result level |
|
|
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:
The
ScenarioRunner.main()method is called.For each script path given in the command line:
A main
ScenarioDefinitioninstance is created [2] from the scenario class in the script [8]. AScenarioExecutioninstance is created as well, and pushed to theScenarioStackinstance [4].ScenarioRunner._execution_modeis set toScenarioRunner.ExecutionMode.BUILD_OBJECTS:In case the steps are defined with
step...()methods, theScenarioDefinitionis fed using reflexive programmation (the same for scenario attributes defined with class members) [4] [8].Each step is executed a first time [4] [5] in order to build its
ActionResultDefinitioninstances for eachStepUserApi.ACTION()andStepUserApi.RESULT()call [6]. During this first execution of the step, the two latter methods returnFalse[1], which prevents the test from being executed at this point.
ScenarioRunner._execution_modeis set toScenarioRunner.ExecutionMode.EXECUTEorScenarioRunner.ExecutionMode.DOC_ONLY[3]. For each step [3] [5]:A
StepExecutioninstance is created [5].The user test code is called [5].
For each
StepUserApi.ACTION()andStepUserApi.RESULT()call [6]:A
ActionResultExecutioninstance is created [6].If a sub-scenario is executed, then it is pushed to the
ScenarioStackinstance [4], built [4] [8] [5], executed [3] [5], and eventually popped from theScenarioStackinstance [7].
The main scenario is eventually popped from the
ScenarioStackinstance [7].
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