Table of Contents
Enroll in Selenium Training

Mobile app cloud-based devices can be a good option for mobile testing teams that have limited access to real devices. Kobiton is a robust mobile device platform that offers real mobile devices for both testers and developers. Moreover, using Katalon Studio, you can efficiently execute automated tests on Kobiton’s devices. Thanks to the built-in integration feature that integrate Katalon Studio with Kobiton.

Subsequently, this tutorial will walk you through the necessary steps that will guide us on how to integrate Katalon Studio with Kobiton. Additionally, we will cover the below topics in this article:-

  • Enable Kobiton Integration
    • Desired capabilities with Kobiton Devices
  • Mobile Testing with Kobiton Device

Enable Kobiton Integration

  1. Firstly, open Kobiton integration settings from the main menu:
  • Windows: Windows > Katalon Studio Preferences > Katalon > Kobiton
  • macOS: Katalon Studio > Preferences > Katalon > Kobiton

After that, check on the Enable Kobiton Integration checkbox.

Integrate Katalon Studio with Kobiton

  1. Secondly, enter your Kobiton account for authentication and click on Connect. After establishing/ making a successful connection with Kobition, the message “Retrieving Kobiton API Keys successfully” will be displayed. Moreover, Katalon Studio automatically retrieves the information for Kobiton integration.

information for Kobiton integration

Other fields in the Kobiton configuration dialog include:

Field Description
Kobiton Server The Kobiton server to connect and integrate with Katalon Studio.
API Key The token to be used by Katalon Studio for exchanging API messages with Kobiton. You can generate more keys from the Kobiton API Settings.
  1. Thirdly, click Apply, and then OK when you are done with the settings.

Desired Capabilities for Kobiton Devices

There will be cases you want to use additional desired capabilities for Kobiton devices(https://docs.katalon.com/display/KD/Mobile+Testing+with+Kobiton+Devices), such as using the appWaitActivity capability to troubleshoot an issue related to starting an application (check it out here). Subsequently, the tips below can help you to overcome this issue.

  1. Grab desired capabilities (https://docs.kobiton.com/automation-testing/automation-testing-with-kobiton/) generated from the Kobiton portal of the device you want to use and paste it to your test script.

Desired Capabilities for Kobiton Devices

  1. Additionally, Insert 'app' capability and pass in Kobiton application id for your device, e.g.,
String kobitonServerUrl = "https://katalon-integration:[email protected]/wd/hub";
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("sessionName", "Automation test session");
capabilities.setCapability("sessionDescription", ""); 
capabilities.setCapability("deviceOrientation", "portrait");  
capabilities.setCapability("captureScreenshots", true); 
capabilities.setCapability("browserName", "chrome"); 
capabilities.setCapability("deviceGroup", "KOBITON"); 
capabilities.setCapability("deviceName", "Galaxy J3(2016)");
capabilities.setCapability("platformVersion", "6.0.1");
capabilities.setCapability("platformName", "Android"); 
capabilities.setCapability('app', 'kobiton-store:10717');
  1. Thirdly, replace the 'Start Application' keyword with these lines. These codes will establish a connection to selected Kobiton's device and also create a driver to be used for other built-in keywords. Thus, you don't have to rewrite the whole test script again.
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import org.openqa.selenium.remote.DesiredCapabilities
import com.kms.katalon.core.appium.driver.AppiumDriverManager
import com.kms.katalon.core.configuration.RunConfiguration as RunConfiguration
import com.kms.katalon.core.mobile.driver.MobileDriverType
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.util.internal.PathUtil as PathUtil
import internal.GlobalVariable as GlobalVariable
import io.appium.java_client.android.AndroidDriver

//Mobile.startApplication('kobiton-store:10717', false)
String kobitonServerUrl = "https://katalon-integration:[email protected]/wd/hub";
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("sessionName", "Automation test session");
capabilities.setCapability("sessionDescription", ""); 
capabilities.setCapability("deviceOrientation", "portrait");  
capabilities.setCapability("captureScreenshots", true); 
capabilities.setCapability("browserName", "chrome"); 
capabilities.setCapability("deviceGroup", "KOBITON"); 
capabilities.setCapability("deviceName", "Galaxy J3(2016)");
capabilities.setCapability("platformVersion", "6.0.1");
capabilities.setCapability("platformName", "Android"); 
capabilities.setCapability('app', 'kobiton-store:10717')

AppiumDriverManager.createMobileDriver(MobileDriverType.ANDROID_DRIVER, capabilities, new URL(kobitonServerUrl))

If you use an iOS device, then please change MobileDriverType.ANDROID_DRIVER to MobileDriverType.IOS_DRIVER.

Now you've finished adjusting the 'Start Application' keyword. Here is the complete code:

import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import org.openqa.selenium.remote.DesiredCapabilities
import com.kms.katalon.core.appium.driver.AppiumDriverManager
import com.kms.katalon.core.configuration.RunConfiguration as RunConfiguration
import com.kms.katalon.core.mobile.driver.MobileDriverType
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.util.internal.PathUtil as PathUtil
import internal.GlobalVariable as GlobalVariable
import io.appium.java_client.android.AndroidDriver

'Instead of using Start Application keyword, we use the below code to create a similar driver so that other Mobile built-in keywords can re-use this driver'.
String kobitonServerUrl = "https://katalon-integration:[email protected]/wd/hub";
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("sessionName", "Automation test session");
capabilities.setCapability("sessionDescription", ""); 
capabilities.setCapability("deviceOrientation", "portrait");  
capabilities.setCapability("captureScreenshots", true); 
capabilities.setCapability("browserName", "chrome"); 
capabilities.setCapability("deviceGroup", "KOBITON"); 
capabilities.setCapability("deviceName", "Galaxy J3(2016)");
capabilities.setCapability("platformVersion", "6.0.1");
capabilities.setCapability("platformName", "Android"); 
capabilities.setCapability('app', 'kobiton-store:10717')
AppiumDriverManager.createMobileDriver(MobileDriverType.ANDROID_DRIVER, capabilities, new URL(kobitonServerUrl))
Mobile.tap(findTestObject('Application/android.widget.TextView - App'), 10)
Mobile.tap(findTestObject('Application/App/android.widget.TextView-Activity'), 10)
Mobile.tap(findTestObject('Application/App/Activity/android.widget.TextView-Custom Dialog'), 10)
'Get displayed message on the dialog'
def message = Mobile.getText(findTestObject('Application/App/Activity/Custom Dialog/android.widget.TextViewCustomDialog'), 
    10)
Mobile.comment('Then the correct dialog message should be displayed')
Mobile.verifyEqual(message, 'Example of how you can use a custom Theme.Dialog theme to make an activity that looks like a customized dialog, here with an ugly frame.')
Mobile.closeApplication()

Mobile testing with Kobiton devices

You need to install the Kobiton Integration plugin and enable the integration. Additionally, if you haven't configured the integration yet, please refer to this document (*https://docs.katalon.com/katalon-studio/docs/integrate_with_kobiton.html#mobile-testing-with-kobiton-devices) for instructions. Subsequently, please follow the instructions to execute your Katalon Studio automation test with Kobiton mobile devices.

  1. Firstly, navigate to Kobiton Portal: https://portal.kobiton.com and login with your username and password.

  2. Secondly, in Kobiton, upload your app to Kobiton App Repository.

Kobiton App Repository

  1. Thirdly, from the Repository view, select 'more actions' and select Automation snippets. Additionally, copy the app ID (the one in bold, for example, Kobiton-store:184 as shown below) and save it.

Automation snippet

  1. Fourthly, click on Devices menu and select your devices by “Mark as favorite”.

Kobiton Devices menu

  1. Fifthly, in Katalon Studio, open your mobile test case and switch to Scripts' view. Locate this line of code:Mobile.startApplication*(appPath,false).*

Next, replace the "appPath” with the Kobiton app id saved in Step 3, as shown below:

replace the appPath with the Kobiton app id

import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCaseMobile.comment('Story: Verify correct alarm message')Mobile.comment('Given that user has started an application')'Get full directory\'s path of android application'

//def appPath = PathUtil.relativeToAbsolutePath(GlobalVariable.G_AndroidApp, RunConfiguration.getProjectDir())

Mobile.startApplication('kobiton-store:184', false)

Mobile.comment('And he navigates the application to Activity form')

Mobile.tap(findTestObject('Application/android.widget.TextView - App'), 10)

Mobile.tap(findTestObject('Application/App/android.widget.TextView-Activity'), 10)

Mobile.comment('When he taps on the Custom Dialog button')

Mobile.tap(findTestObject('Application/App/Activity/android.widget.TextView-Custom Dialog'), 10)

'Get displayed message on the dialog'

def message = Mobile.getText(findTestObject('Application/App/Activity/Custom Dialog/android.widget.TextViewCustomDialog'),10)

Mobile.comment('Then the correct dialog message should be displayed')

Mobile.verifyEqual(message, 'Example of how you can use a custom Theme.Dialog theme to make an activity that looks like a customized dialog, here with an ugly frame.')

Mobile.closeApplication()
  1. Sixthly, from the main toolbar, click on the drop-down menu of Run. Select the option to run with Kobiton Device.

run with Kobiton Device

  1. Seventhly, on the Kobiton Favorite Devices screen, a list of Favorite Devices from Step 4 will be displayed in Device Name. Select the preferred device and click Ok.

Additionally, you can also modify this list by updating your Favorite Devices from https://portal.kobiton.com/devices.

Kobiton Favorite Devices_Integrate Katalon Studio with Kobiton

  1. Finally, once Katalon Studio is finished, automation test execution will be uploaded to Kobiton. After that, navigate to the Sessions menu to view

automation test execution_Integrate Katalon Studio with Kobiton

Congrats! You have just executed your Kobiton mobile automation test with Katalon Studio. Kobiton is an innovative mobile device testing platform. Additionally, through Kobiton, developers can save cost and time by directly remote access to mobile devices to run the test before releasing it to the market. Consequently, this will empower mobile developers to build high-quality applications by identifying potential issues faster.

Using XPath Generator for test recording in Katalon Studio
Using XPath Generator for test recording in Katalon Studio
Previous Article
Katalon Studio Integration with Jira Overview
Katalon Studio Integration with Jira Overview
Next Article

Similar Articles