You can add easily high-level statements to Mobile and
Web UI tests, including transactions, loops, if-then conditional statements,
and random selectors. A wizard is used to automatically split your
test and insert a statement from the nodes selected in your test script,
and then perform test refactoring.
Before you begin
Record a test from a mobile device or on desktop and edit the test script.
About this task
Mobile and Web UI actions can be played back on devices only if they are embedded in a
Launch node or in an In application node in a test script. You cannot insert a statement into a
Mobile or Web UI test script under a selected node. So, when you add a transaction, loop, if-then
conditional statement or random selector statement to a test script, two containers are
automatically created : an In application node and a node with the name of the statement. The
selected steps are grouped under an In application node and embedded in the statement container. The
actions in this node will be performed in the application during playback and the statements will be
tested. Separate In application nodes are created to contain the test elements around the selected
steps that should not be part of the loop, transaction, or other statement.
Note: When you run a test from the mobile
client on mobile devices, it uses the same values that you used during
recording. If you modify the test script and create a datapool or
variable, or if you add a condition, a loop, custom code, references
or add other statements, they are not taken into account by the mobile
client at run time. To verify that the initial recorded values are
substituted with variable data, you must initiate the test run from
the workbench.
Note: As in a Mobile or Web UI test, you can have several
applications running at the same time. The In application node is used to determine which
application is tested in the different test sequences, and it enables switching between applications
in the test.
Procedure
To add transaction, loop, if-then condition, or random
selector statements to a test script:
- Select one or multiple steps in the test script, right-click
or click the Option button, and then select Split
Mobile or Web UI actions.
- Select Split and create container in
the wizard and select a transaction, loop, if,
or Random selector statement. Do one of the
following steps to activate a dynamic view that is a sample of a test
structure before and after refactoring:
- If the statement should apply to steps selected in one
or more nodes in the test script, select Create containers
for selected nodes only.
- If the statement should apply to all nodes of the test
script, select Create containers for all group of nodes.
- Click Next to see the test refactoring
wizard page. This page examines the changes to be performed as a result
of the split and the insertion of a statement into the test script.
You can clear the options if you do not want certain changes to be
performed. Click Finish to perform refactoring.
Results
A node is created in the test script for the if-then condition
![if-then condition](../images/conditional.gif)
,
transaction
![transaction](../images/transaction.gif)
, random selector
![random selector](../images/randomloop.gif)
, or loop
![loop](../images/loop.gif)
statement and the In application nodes with the selected
group of steps.
You can add the statements manually, to do this
you must first split the test, then add the statements and move the
objects manually in the test script. For details on the procedures,
see Adding
test elements.