Test Automation refers to automating the testing process of applications. Katalon studio is one of the popular open source automation tools used by software testing companies to automate the web and mobile applications. In this tutorial we will be seeing how to get started with the tool.
Katalon studio is an open source automation tool which can be used for testing web, mobile application and API testing.
It is developed on top of the open source automation frameworks such as selenium and appium.
Katalon script runs in all modern browsers. Test reports will be generated in the Katalon studio once the script completes its execution. These reports can be exported as HTML, PDF…etc.
Dependencies Required for Mobile Automation Using Katalon Studio
- Katalon Studio
- Android device with enabled developer mode and Android sdk
Need of Appium and Node.js
Appium is a server written in Node.js. This is used to automate hybrid and native mobile applications.
Appium handles multiple webdriver sessions. This provides cross platform testing i.e. it works for both android and ios apps.
This is used to translate webdriver commands to UIAutomator or UIAutomation depending on the device type.
Install Katalon Studio
Please follow this link https://www.katalon.com/ to download and install Katalon studio.
Please follow this link https://nodejs.org/en/download/ to download and install Node.js.
Installed Node.js version can be found using the command: Refer the Fig 1.
Command to install Appium: Refer the Fig 2
‘npm install -g appium’
Set the appium directory settings in Katalon studio.
- Open Katalon Studio
Windows>> Katalon Studio Preferences >> Katalon >> Mobile
- Here, set AppiumDirectory folder and it looks like
Enable Developer Mode & USB Debugging Mode
- Install USB driver for your device in your system.
- First check whether the developer option is enabled in your device or not.
Go to Settings>>Developer options.
- If developer options is not available,
Go to Settings>>About phone>>Build number
Tap this build number for seven times to enable developer options.
- Then come back to settings and click on developer options to enable USB debugging mode.
- It displays popup message with title “Allow USB debugging?” click ok button to enable the USB debugging mode.
Test Case Generation
Creation of Test script
Katalon studio provides two ways to create a mobile test automation test script.
Record mobile option is available in the Katalon studio main tool bar. This option is used to record each and every mobile activity.
This will generate the script based on recorded activity. Refer Fig 4 to locate Record mobile option available in the Katalon studio.
Steps to create test script using Record Mobile
Step 1: Create a new test case in Katalon Studio by right clicking the test cases folder.
Step 2: Click Record Mobile option from main toolbar.
Step 3: Mobile Recorder dialog box is displayed. Refer the Fig 5
Step 4: Connect the device to your system. Popup message will be displayed in your device with title “Allow USB debugging?” click OK and then click refresh in the Katalon studio to see your mobile name in the device name drop down.
Step 5: Locate your application file (.apk) from the system
Step 6: Click start icon to start recording the mobile activities. Refer the Fig 6
Step 7: Device view dialog box shows the image of your device. Refer the Fig 7
Step 8: Click on any one object from device view and select required action from available actions section. Refer the Fig 8
Step 9: Actions captured during recording can be found in the recorded action section. Refer the Fig 9
Step 10: Once recording is done, Click on OK to save the recording and the appropriate test steps can be generated as shown in Fig 10.
Step 11: Click Run and select your device from the list to execute the test case. Each and every step defined in the test script will be executed in the connected device.
Spy mobile option is available in the Katalon studio main tool bar. This option is used to capture test object available in the mobile applications.
With the help of the captured objects, test script can be created using manual mode. Refer the Fig 11 below to locate Spy mobile option available in the Katalon studio.
Steps to capture test objects using Spy Mobile
Step 1: Connect the device to your system and click on Spy Mobile option.
Step 2: Mobile Object spy dialog box will be displayed. Refer the Fig 12.
Step 3: Connect your device and select your device name from the dropdown. Click start icon to launch the application in your device.
Step 4: Once the application is launched, the entire test objects in the device view will be displayed as a hierarchical view in the all objects section. Refer the Fig 13.
Step 5: If you want to add any object in to object repository, then select that object from the hierarchical view and click ‘Add’ to Object Repository button which is located at the top left corner of the object spy dialog box. Refer the Fig 14.
Step 6: If you want to capture objects in next screens of the application, click capture object button which will give you the screenshot of the next screen in the device view .Refer the Fig 15
Step 7: Katalon studio gives you the option to save the objects in your preferred folder. Select your preferred folder and click Ok button to add the object to OR. Refer the Fig 15