Part 2: Parameterization of asynchronous packages¶
Objective
Parameterization of asynchronous packages with input and return values
Test creation
Switch to “sender” in test case editor
Create the numeric variable “loopCounter” with the standard value by selecting in the context menu of tab Variables right below the test case editor
Create the numeric variable “maxLoop” with the standard value
Edit the loop by entering “maxLoop” as number of loops and “loopCounter” as counter
The variable “maxLoop” is marked as input parameter and the variable “loopCounter” as return value see image “Variables with parameter marking”)
As in the above procedure, the packages “receiver1” and “receiver2” are to get the variable “maxLoop” as input parameter and number of loops, and the variable “loopCounter” as loop counter (“loopCounter” needs not be marked as return value)
Switch to “main” in test case editor
Create the numeric variable “sendCountInput” with the value 10
Create the numeric variable “sendCountOutput” with the standard value
Open the package parameterization dialog of “sender” by double-clicking the package in the entry of “main” in the test case editor, and create the parameter-and-return link like in image “parameterization with variable link”
The packages “receiver1” and “receiver2” are to be attributed the same input parameter (sendCountInput) like in the previous step
After calling up “receiver2” in the test case of “main”, insert an if-then-else branching with the condition “sendCountInput == sendCountOutput”
Insert into the “THEN” branch the comment “sending counter coincides with expectation” with the evaluation “SUCCESS”
Insert into the “ELSE” branch the comment “sending counter does not coincide with expectation” with the evaluation “FAILED”
Save all packages and execute the main package
Variables with parameter marking¶
Parameterization with variable link¶
Result
The package “main” provides “sender”, “receiver1” and “receiver2” with an input parameter which controls the number of loop runs. In addition, the return value is read out by “sender” and compared with the transfer parameter.
Remark
“Main” now waits explicitly for “sender” to finish in order to evaluate sender’s return value.