More Advanced Topics - google/android-uiconductor GitHub Wiki
If-Else Logic In Uicd
Certain test cases need certain aspects for the test to function correctly. Conditional statements are important in Uicd when we want to perform different actions based on different conditions. If-else is an important concept and can be utilized in Uicd. Let's say we need an app from the Google Playstore, but we are not sure if that app is installed on the devices we need. We can build a workflow in Uicd to see if we need to install the app or not. Think of it like this, if app is not installed, install the app else do not install the app. Once the if-else in Uicd has run it can continue with test sequence. Below is a diagrams to help understand the if-else concept.
EXAMPLE
Here we are checking if the Mobile Utilties app is installed, if not, install mobile utitilies app and continue the test sequence, and if mobile utilities is installed, do not install, and continue with test sequence. This is a very simple case of an if-else compound logic. For reference will call this logic, "mobile utilities logic".
The first thing we want to do is create a workflow to build the mobile utilities logic. This logic will be used as a single compound in a main workflow using the Mobile Utilities app. After building this, we can add it to any main workflow/test case.
It is very important to use the correct stop type in this sequence. In this case We are using "Stop Current Compound if False". If using Stop Current Compound if False/True it needs to be used as single compound to be used correctly.
IMPORTANT: Stop Current Compound if False/True does not fail or pass the tests. They just skip the remaining actions of the current compound actions.
The following is a table of stop types.
Type | Description |
---|---|
Fail Test If Validation False | Stop and fail the test if the validation is false. |
Fail Test If Validation True | Stop an fail the test if the validation is true. |
Stop Current Compound if False | Break the current compound action if the validation is false but continue test sequence. Note: This validation does not fail the test. |
Stop Current Compound if True | Break the current compound action if the validation is true but continue test sequence. Note: This validation does not fail the test. |
The following is an illustration of the mobile utilities logic being called as a single compound by an actual workflow.