Start and end¶
Start
The start of a parallel test thread is accomplished by means of the parallel (also called asynchronous) call of a package. That is done by the test step “parallel package reference”.
“Parallel package reference” is inserted into the test case, similarly to the classical package reference, by means of a context menu command of the workspace explorer
The classical package call is also referred to as synchronous call.
As with a synchronous call, parameters can be given to the calling package. In the caller it is possible to define the target variables into which the return values of the called package are to be inscribed.
Runtime and termination
Asynchronously called packages end:
after execution of their last test step which is determined by the control flow
after execution of the test step “return”
in case of a test abort
Asynchronously called packages cannot be aborted forcibly (by the caller) except in case of a test abort; they always end by themselves. However, they can be sent a demand for termination (see Exchange of messages between parallel test threads).
Note: If an asynchronously called package has in turn started parallel subpackages, it will wait after execution of its last test steps, except in case c) for the termination of all subpackages before coming back. That means subpackages executed in parallel never live longer than the superordinate parent package. That behavior is referred to as implicit join of a package with its subpackages.
Synchronization and access to return values of an asynchronously called package
The return values of a package are not available until the end of its execution, and only then are they inscribed into the target variables of the caller. So the caller of a parallel package has to wait for the end of that package before it can access its return values. That is done automatically as soon as a test step of the caller reads one of the target variables or as part of the variable dump used for the trace analysis when executing a stop trace step. Then the reading access blocks the caller until the end of the subpackage (also referred to as explicit join of a package with its subpackage).
The writing access to a target variable fails as long as the asynchronous execution of the subpackages is not terminated. The same is true for the new assignment of a target variable in a second asynchronous call, as long as the first call is not terminated.
Reporting¶
The presentation of asynchronous calls of packages in a test report is made in the same way as that of synchronous ones. However, the color marking of the calls is different. Furthermore, subpackages executed in parallel cannot be presented in line (i.e. interlaced with the test steps of the parent package) because of the time overlap with their parent package.