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
ScenarioDefinition
instance is created [2] from the scenario class in the script [8]. AScenarioExecution
instance is created as well, and pushed to theScenarioStack
instance [4].ScenarioRunner._execution_mode
is set toScenarioRunner.ExecutionMode.BUILD_OBJECTS
:In case the steps are defined with
step...()
methods, theScenarioDefinition
is 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
ActionResultDefinition
instances 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_mode
is set toScenarioRunner.ExecutionMode.EXECUTE
orScenarioRunner.ExecutionMode.DOC_ONLY
[3]. For each step [3] [5]:A
StepExecution
instance is created [5].The user test code is called [5].
For each
StepUserApi.ACTION()
andStepUserApi.RESULT()
call [6]:A
ActionResultExecution
instance is created [6].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 theScenarioStack
instance [7].
The main scenario is eventually popped from the
ScenarioStack
instance [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