This tutorial allows you to build and execute test cases within mobile studio. You can create a test with different actions namely Click, Find Element and Send Keys. A test step is made up of an action and an Xpath. After all the steps are added you can run the test by a click of the button.
To develop a test you'll need to Open a device in Automation Mode
Test Editor Flow
There are 2 flows you can follow when you use the Test Editor.
- Select an element and copy its Xpath to the filter, click on the Add step button (marked in the screenshot). When you click on the button a dropdown will open with 3 actions namely Click, Find Element and Send Keys. Select an action and a dialog/window will open. A new step will already be added to the dialog/window. The step action will be same as your selection and the XPath text area will have the same value as filter text field.
- Click on a Test Editor button (marked in the image) a dialog/window is opened with Title Test Editor. This dialog/window contains an Add Step button. Click on the button and select your preferred action and add a Xpath to the step.
The next task is to run the test. Running a test is very simple. Once all your steps are ready, click on the Run button(Play icon) to run the test.
Add Step will only be enabled if there is xpath in filter input. If the filter input is empty, Add Step will be disabled.
Test Editor Actions
Active Steps are steps whose checkbox is marked true/tick.
There are a bunch of action you can perform in text editor. Let's go over them one by one.
- Position Window: You can position test editor window in 4 ways. Floating and Aligned to the Right,Left or bottom. You can change the position of the window from the position button.
- Documentation link.
- Add Step: You can add a new step. When clicked on this button a dropdown will open from where you can select the action.
- Play/Pause: When your test is ready, click on the play button to run it. The test will run one step at a time. Steps will be executed in the same order as displayed on the screen. Only active steps will be executed. Once the test execution starts, Play button will be replaced by Pause button. Click on Pause button will stop the execution of test.
- Delete: Delete button will delete the steps. Only Active steps will be deleted.
- Drag & Drop: You can drag and drop to change the order of steps.
- Action Dropdown: You can change the action type from this dropdown.
- Locate By Dropdown: Since currently we only support XPath based search in test editor, this dropdown is disabled.
- Xpath Text Area: Write Xpath here.
- Export Code: Export code will take you to a screen which displays generated code in available formats.
When you click Export code button you will see a screen with the generated code. You can select the language from the drop down above. There is a Copy button at the bottom of the screen from where you can copy the code straight to your IDE.