Scripting your first mobile automation test case can be quite confusing without a specialized tool or instructions. In this tutorial, we will show you how to speed up your automation project using Katalon Studio’s mobile recording utility and running your recorded test cases on hundreds of Kobiton’s mobile devices on cloud. For this tutorial, we assume that you have already installed Katalon Studio, got familiar with its basic functions.
Create Mobile Automation Test Cases Using Katalon Studio’s Recording Utility
Before starting, make sure that you have:
- Downloaded the target app under test: Material Login Demo. This app provides a set of simple authentication features that will be automated as demonstrated below.
- Configured your Katalon Studio instance for mobile testing.
Katalon Studio provides two utilities to accelerate the automation process: Mobile Object Spy to quickly populate the project’s object repository, and Mobile Recorder to generate automation scripts from recorded actions. As this tutorial mainly focuses on the functionalities of the Recorder utility, if needed, refer to the Object Spy user guide available from Katalon Studio Documentation on how to use this utility.
- Let’s open the sample project (already included in Katalon Studio) and create a new test case. Click on the Mobile Recorder button to open its dialog, as shown below:
2. With the dialog opened, follow the following steps to configure your recording session:
- Plug in your device or start your emulator then select it from the Device Name combo box.
- Click Browse… to select the app file from your computer (.apk for Android, .ipa for iOS apps).
- Click Start and wait for the app to launch on your device.
Once the configuration is completed, the app appears as shown in the screenshot above. (Note: starting the app is registered as the first recorded action.)
3. With your app ready on your mobile device, start recording the test case.
- Tap on “No account yet? Create one” to navigate to Create Account. Select the android.widget.TextView0 object in the all objects tree (or you can tap the text on the Device view to focus on the object).
- Then, click the Tap button to record the action. This action simulates a tap on the app.
You will be directed to the Create Account screen. Fill in the information to create an account.
Select android.widget.EditText0 (or tap on the Name text box on the Device view to fill in name).
Then click Set Text to perform the set text action on the Name text.
Enter “name” for the text input as below. Click OK.
The text is set to the device, and the action is recorded to the Recorded Actions table.
- Perform the same steps with the Address field, and enter “address” for this field.
- To enter the value for the Email field, we will need to hide the on-screen keyboard to make the field visible by pressing the Hide Keyboard action button. Select the Email field to perform the set text action using “email@example.com.”
- Follow the same steps for the Mobile Number, Password and Re-enter Password text fields.
- Finally, click on Tap to tap on the Create Account. You will be redirected to the main screen.
- Click Stop on the Mobile Recorder dialog to stop the recording session.
The recorded actions should look like as below:
- Click OK to complete the recording and then choose a folder to store your captured objects. Click OK again for Katalon Studio to generate test scripts.
4. View your test case in the Manual mode or replay it to validate all recorded steps. Now let’s add validation points for this test case to verify whether the recorded inputs can set to the text fields successfully.
- Select the first Set Text From the Add toolbar or by clicking on Add from the context menu, add a Mobile Keyword step and choose the keyword Verify Element Attribute.
- Select the test object representing the Name text field, which is widget.EditText0, as the object to verify.
- Double click on the input cell for the test step and set the following values to validate the step of setting text to Name.
- Perform the same procedure for all other Set Text.
After adding the validation test steps, try to run the test case again. This time it will take longer for Katalon Studio to perform the validation steps, but your test case should pass successfully since the input value is identical to the validation value. You can test with different values or connect to a data source.
Katalon Studio is a free, a full-feature automation solution that can be downloaded at www.katalon.com. Let me know if you have any questions/suggestions in the comment section below.