Getting Started With Mobile Automation Using Katalon Studio – The Free Automation Tool

Mobile-Automation-using-Katalon-studio

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.

Test Automation

Tool Description

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. Groovy, Java and JavaScript are the main scripting language which can be used to write script in Katalon studio. 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
  • js
  • Appium
  • 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. Since Appium written in Node.js, we need node to run it .So it is required to install node.js. Node.js is a JavaScript runtime environment which can be used to execute JavaScript from outside the browser.

Installation

Install Katalon Studio

Please follow this link https://www.katalon.com/ to download and install Katalon studio.

Install Node.js

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.

‘node –v’

Fig 1- Command to know installed Node.js version
Fig 1- Command to know installed Node.js version

Appium Installation

Command to install Appium: Refer the Fig 2

‘npm install -g appium’

Fig 2- Command to install appium
Fig 2- Command to install appium
Fig 3 - Command to know the installed appium version
Fig 3 - Command to know the installed appium version
Mobile-Apps-Testing

Configuration

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

‘C:\Users\Indium software\AppData\Roaming\npm\node_modules\appium’

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

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.

Fig 4- Record Mobile option
Fig 4- Record Mobile option

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

Fig 5- Mobile Recorder Dialog Box
Fig 5- Mobile Recorder Dialog Box

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

Fig 6 - Click Start icon
Fig 6 - Click Start icon

Step 7: Device view dialog box shows the image of your device. Refer the Fig 7

Fig 7- Device View
Fig 7- Device View

Step 8: Click on any one object from device view and select required action from available actions section. Refer the Fig 8

Fig 8 - Test object is highlighted in device view
Fig 8 - Test object is highlighted in device view

Step 9: Actions captured during recording can be found in the recorded action section. Refer the Fig 9

Fig 9 - Recorded Actions Section
Fig 9 - Recorded Actions Section

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.

Fig 10 - Generated Test Case Script
Fig 10 - Generated Test Case Script

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

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.

Fig 11 - Spy Mobile option
Fig 11 - Spy Mobile option

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.

Fig 12 - Mobile Object spy
Fig 12 - Mobile Object spy

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.

Fig 13 - Hierarchical View of the test objects
Fig 13 - Hierarchical View of the test objects

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.

Fig 14 - Capture Objects
Fig 14 - Capture Objects

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

Fig 15 - Capture Object button
Fig 15 - Capture Object button

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

Fig 16 - Object Repository Location Selection
Fig 16 - Object Repository Location Selection

Leave a Reply

Your email address will not be published.

Shares