You can set test execution conditions on actions in a test.
To do so, you create a condition for a block of actions that will
be executed one time only, during the first test run, after the installation
step of the application. The block of actions will be ignored on subsequent
test runs, thus preventing step failures. This is a Responsive Design
condition.
About this task
This task applies to tests recorded from Android applications
that require login credentials and, possibly, location information
the first time the tests are run. This task also applies to applications
whose behavior is dependent on the target device used to record and
replay the test (with different resolution, type of device, orientation,
OS level, native language, and such other parameters).
Procedure
- Select the steps in the test script being edited, and click . When prompted Would you like to move the selected objects under the
inserted element?, click Yes.
Figure 1. Insert a Responsive Design Condition to selected steps
- In the Responsive Design Condition details area,
assign a name to the condition in the Condition Name field.
By default, the condition name is set to the current activity (or
screen) of the first selected action. The condition name is used as
a comment to identify the condition in the test. For example,
consider an application where users are prompted to enter their location
to find the nearest shop. The purpose of this condition is to run
the block of actions only the first time that the test is run after
the application is installed. The block of actions should not be run
on subsequent test executions.
Figure 2. Assign a name to the condition
and to the application part
- Assign a name to the Application Part,
which is the key used to identify the condition. It is the variable
shared with conditions in the same application. If multiple conditions
share the same condition part, in the same application or in several
applications, the condition will be executed one time only.
- When the steps are complete, run the test again. The block
of actions should be executed only the first time the application
is installed, and the first time the test is run. The other times
the test is run, the actions will not be executed. Verify in the test
report that no errors are generated for these steps.