Scripting your first mobile automation test case can be quite challenging without a specialized tool or instruction. Subsequently, this tutorial 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 cloud based devices farm. We assume that you have already installed Katalon Studio for this tutorial, got familiar with its basic functions, and registered a Kobiton account (https://kobiton.com). We will be discussing the below topics in the article, Test mobile apps using Katalon and Kobiton’s cloud based device farm :
- Create mobile automation test cases using Katalon Studio's recording utility
- Run your mobile automation test case with Kobiton’s cloud based device farm
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 offers 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 quickly populates the project’s object repository, and Mobile Recorder to generate automation scripts from recorded actions. As this tutorial mainly focuses on the Recorder utility's functionalities, if needed, refer to the Object Spy user guide available from Katalon Studio Documentation (https://goo.gl/e2RfrH) on how to use this utility.
- First, let’s open the sample project (already included in Katalon Studio) and create a new test case. After that, click on the Mobile Recorder button to open its dialog as shown below
Section | Explanation |
---|---|
Device View | Device inspector view. A preview of device UI will be displayed here. Click on any element to select. |
Configurations | Select setting for a recording session |
All Objects | The current mobile elements hierarchy on the device. Click to select an element and view its properties in Object Properties. |
Possible Actions | All available actions that can be performed on the device |
Object Properties | All properties of the selected element in All Objects. |
Recorded Actions | All recorded actions appear here. |
- Secondly, with the dialog opened, follow the following steps to configure your recording session:
- First, plug in your device or start your emulator, then select it from the Device Name combo box.
- Second, click Browse… to select the app file from your computer (.apk for Android, .ipa for iOS apps)
- Finally, 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 the first recorded action).
- Thirdly, with your app ready on your mobile device, start recording the test case.
- First, tap on “No account yet? Create one” to navigate to the Create Account. After that, select the android.widget.TextView0 object in the all objects tree. (Or you can tap/click the text on the Device view to focus on the object).
- After that, click the Tap button to record the action. This action simulates a tap on the app.
Subsequently, you will be directed to the Create Account screen.
- First, fill in the information to create an account.
- Second, select android.widget.EditText0 (or tap on the Name text box on the Device view to fill in name).
- After that, click Set Text to perform the set text action on the Name text.
- Finally, enter “name” for the text input as below. Click OK.
The text is set to the device, and we record the action to the Recorded actions table.
- Perform/ execute the same steps with the Address field, and enter “address” for this field.
- To enter the Email field's value, we will need to hide the on-screen keyboard to make the field visible by pressing the Hide Keyboard action button. After that, select the Email field to perform the set text action using “email@domain.com”.
- Similarly, 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 redirect to the main screen.
- Lastly, click Stop on the Mobile Recorder dialog to stop the recording session.
The recorded actions should look like as below:
- Click OK to complete/finish the recording and then choose a folder to store your captured objects. After that, click OK again for Katalon Studio to generate test scripts.
- Fourthly, view your test case in the Manual mode or replay it to validate all recorded steps. Let’s now add validation points for this test case to verify whether the recorded inputs can be set to the text fields successfully.
- First, select the first Set Text From the Add toolbar or click on Add from the context menu. After that, add a Mobile Keyword step and choose the keyword Verify Element Attribute.
-
Secondly, select the test object representing the Name text field, which is a widget.EditText0, as the object, to verify.
-
Thirdly, double click on the input cell for the test step and set the following values to validate the setting text to Name.
- Lastly, perform the same procedure for all other Set Text.
After adding the validation test steps, try to rerun the test case. Moreover, this time the execution will take longer for Katalon Studio to perform the validation steps. Still, your test case should pass successfully since the input value is identical to the validation value. Additionally, you can test with different values or connect to a data source.
Run your mobile automation test case with Kobiton’s cloud based device farm.
- First, upload the Material Login Demo app to Kobiton App Repository. From the Repository view, select/ chose the more actions button and select the Automation snippet Copy the app id (the one in bold, for example, Kobiton-store:184 as shown below) and save it.
-
Secondly, navigate to the Kobiton Devices page. After that, choose the devices you want to run your test and mark those devices as a favorite by clicking on the star icon.
-
Thirdly, let’s enable Kobiton integration.
- Open Katalon Studio Preferences (Windows -> Katalon Studio Preferences) then select/chose Kobiton.
- After that, enter your Kobiton username and password. Click Connect to test the connection and authentication. Moreover, with a valid account, Katalon Studio automatically retrieves the API keys from Kobiton.
- Finally, click Apply or OK to save the settings.
- Fourthly, open the test case created from the previous section, replace the input application path for the first step, “Start Application” with the Kobiton app id saved in Step 1.
- After that, a new menu option appears under the Execution toolbar as below. Subsequently, click on Kobiton Device to open the Kobiton Favorite Device dialog.
- Sixthly, select your target device for execution from the Kobiton Favorite Device list. Click OK to start execution with that device. It may take some time to initialize the connection to Kobiton before the execution. Moreover, you should log in to Kobiton sessions to view the result once the test execution is completed.
The combination of Katalon Studio and Kobiton empowers/enables automation engineers in validating the quality of mobile apps by allowing them to execute recorded test cases on hundreds of devices quickly. Moreover, this solution does save them not only time but also maximizes test coverage. Katalon Studio is a full-feature automation solution with both free and licensed versions downloaded at the Katalon Studio website (www.katalon.com). Kobiton's cloud-based device farm that provides real devices for manual and automation testing at an affordable price. Moreover, you can register Kobiton for a free trial. Let me know if you have any questions/suggestions via the email below.