Tutoriel en version vidéo: Nous vous guidons pas à pas à travers QF-Test...
Version 8.0.1 |
You already came across 'If' nodes in the 'Setup' sequence in the chapter Starting the Application. Let's have a closer look at the details of the node.
Figure 26.1: Setup Sequence with if-else structures |
By means of an 'If' node you can control whether certain nodes
will be executed or not. In our case whether to start the SUT application.
First, we need to find out if the client is already running.
This is the job of the 'Wait for client to connect' node, which writes the result
of its inquiry, either true
or false
, into a variable named
isSUTRunning
.
Figure 26.2: 'Wait for client to connect' writes the result into the variable "isSUTRunning" |
The 'If' node has a 'Condition' attribute where you'll find an
expression evaluating the result variable isSUTRunning
. As we want to refer
to its value we need to use the syntax $()
(see also note on variable syntax
in chapter section 24.1).
Figure 26.3: 'If' node evaluates the variable |
Depending on whether the client is already running or not QF-Test will execute the nodes nested in the 'If' node.
If you like you can check the value of the variable isSUTRunning
in the
variable bindings table. The first time it will have the value false
so that the condition not $(isSUTRunning)
will become
true and the SUT will be started. The second time it will be true
and the if-condition
will fail. The nodes nested in the 'If' node will be skipped.
Note Within the first node of the setup sequence you will find more 'If' nodes. They are used to set global variables determining which win browser to use, depending on the operating system. For better readability only 'If' nodes have been used. You may just as well use 'Elseif' and 'Else' to implement that functionality. The child nodes of an 'Elseif' node would be executed if the 'If' condition were false and the 'Elseif' condition were true. The child nodes of an an 'Else' node would be executed if the 'If' condition and all 'Elseif' conditions were false.
For checking the operating system you can directly resort to a QF-Test variable:
QF-Test stores the information about the operation system in a group variable
where the group is called 'qftest' and the variables 'linux', 'macos' or 'windows',
respectively. The syntax for accessing group variables is ${group:varname}
,
e.g. ${qftest:windows}
.
Last update: 9/10/2024 Copyright © 2002-2024 Quality First Software GmbH |
1. Cookies fonctionnels
Nous utilisons des cookies fonctionnels pour garantir la fonctionnalité de base du site web.
2. Cookies de performance et de statistique
Nous utilisons Matomo pour analyser et améliorer notre site web. Des cookies permettent une collection anonyme des informations qui nous aident à vous offrir un visite clair et facile à utiliser de nos pages web.
This cookie contains a unique, pseudonymized visitor ID internal to Matomo for recognizing repeat visitors.
This cookie is used to track from which website the anonymized user proceeded to any page or sub-page.
The Matomo session cookie is used to track the visitor's page requests during the session. The cookie is automatically deleted at the end of each session (website visit), at the latest after one day.
is created and should be then directly deleted (used to check whether the visitor’s browser supports cookies).
short lived cookies used to temporarily store data for the visit.
short lived cookies used to temporarily store data for the visit.