Ensure Mobile App Testing with Effective Automation Solution Combo:
Scripting your first mobile automation test case can be quite confusing without a specialized tool or instruction. In this tutorial, we will show you how to speed up your automation project using Katalon Studio mobile recording utility and running your recorded test cases on hundreds of Kobiton mobile devices. For the specific purpose of this tutorial, we’re going to assume that you installed Katalon Studio and got familiar yourself with the basic functions and registered a Kobiton account.
Create the mobile automation test case using Katalon Studio recording utility
Before we kick off make sure that you have:
- Downloaded the target app – 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 the Mobile Recorder to generate automation scripts from the recorded actions. This tutorial addresses the functionalities of the Recorder utility, please refer to the article for Spy utility user guide on Katalon Studio Documentation.
Let get started by opening the sample project and create a new test case. Click on the Mobile Recorder button to open its dialog, the utility’ functions are demonstrated on the image below.
With the dialog opened, follow these steps to configure your record session:
- Plug in your device or start your emulator then select it on the Device Name combo box.
- Press Browse… the application file from your local machine. (.apk for Android, .ipa for iOS applications)
- Press Start button and wait for the application to start on your device.
Once the configuration is completed, you will see a similar output as the screenshot above. (Note: starting the application is registered as the first recorded action.)
With your app is ready on your mobile device, let start recording our test case.
- Tap on “No account yet? Create on” text to navigate to the Create Account
Select the android.widget.TextView0 object on the all objects tree or tapping the text on the Device view to focus on it.
Then press Tap button to record the action.
You will be directed to Create Account screen.
- Fill in the information to create the account.
Select the object android.widget.EditText0 or tap the Name text box on the Device View to fill in name. Then press Set Text button to perform the set text action on the Name text.
Enter the name into the popup input dialog as name as below and press OK.
The text will be set to the device and the action will be recorded to the Recorded actions table.
- Perform the same steps with the Address field and entering the text address.
- To enter value on the Email text field we will need to hide the on-screen keyboard to make the Email text field visible by pressing the Hide Keyboard action button. Select the Email field to perform actions set text with the value [email protected]
- Follow the same procedure for Mobile Number and Password and Re-enter Password text fields.
- Finally, click on Tap button to tap on the Create Account You will be redirected to the Main Screen and have completed the recording session.
- Press the Stop button to stop the recording session.
The recorded actions should look like the image below:
- Press OK to complete the recording, choose a destination folder to store your captured objects and press OK again for Katalon Studio to generate the test scripts.View your test case with Manual mode interface or replay it to validate all recorded steps. Let add validation points for this test case to verify the recorded input had set to the text fields successfully.
- Select the first Set Text step, then from the Add toolbar or by clicking Add from the context menu, add a Mobile Keyword step and choose the keyword Verify Element Attribute.
- Select the test object to represent the Name text field, which is widget.EditText0, as the object for the verify step.
Double click on the input cell for that test step and set the following values to validate the step of setting text to the Name text field.
- Perform the same procedure for all others Set Text
After adding validation test steps, try to run the test case again. This time the execution 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.
Run your mobile automation test case with Kobiton cloud’s devices
First of all upload the Material Login Demo app to Kobiton App Repository using your account. From the Repository view, select the more actions button and select the Automation snippet option. Copy the app id (the one in bold, for example, Kobiton-store:184 from the image below) and save it.
Navigate to Kobiton Devices page. Choose the devices you want to run your test on and mark those devices as favorite by clicking on the star icon.
Let enable the integration to connect Katalon Studio with your Kobiton account.
- Open Katalon Studio Preferences by clicking on Windows -> Katalon Studio Preferences, then navigate to the Kobiton
- Enter your Kobiton username and password and press Connect to test that account. With a valid account, Katalon Studio will automatically retrieve the API keys from Kobiton for you.
- Press Apply and OK to save the settings and exit.
Open our test case in the previous section, replace the input application path of the first step “Start Application” with the Kobiton App id saved on step 1.
A new menu option will be available under the Execution toolbar as below. Click on Kobiton Device to open the Kobiton Favorite Device dialog.
Select your target device for execution from your Kobiton Favorite Device list and press OK to start execution with that device. It may take some time to initialize the connection to Kobiton cloud prior to the execution. You should be able to login to Kobiton Sessions to view the execution result once it’s completed.
This combo, Katalon Studio, and Kobiton empower the automation engineer to validate the mobile app quality by executing the recorded test cases on hundreds of devices in just minutes. This solution will not just save you time but also maximize your test coverage with very low cost. Katalon Studio is a FREE – full feature automation solution that can be downloaded at Katalon Studio website (www.katalon.com). Kobiton is a mobile cloud that provides real devices for both manual and automation testing with affordable price, you can register your trial here. Let me know if you have any questions/suggestions on the comment section below.
Check out the complete Katalon Studio Tutorial by clicking on below link:
About the Author:
Currently working as a senior full-stack developer for KMS Technology, Hieu Mai is one of the developers behind Katalon Studio. With 5 years’ experience in Desktop & Mobile applications development and automation testing, Hieu brings this expertise to develop Katalon Studio.
Contact him at [email protected]nology.com