Automated Parallel Testing of Mobile Applications on Kobiton using Appium, Java and TestNG

This article describes the process of executing two or more tests in parallel on Kobiton test cloud service, using Appium, Java and TestNG.

 

Introduction

 

What is Kobiton?

Kobiton is a mobile testing platform that accelerates delivery and testing of mobile apps by offering manual and automated testing on real devices in cloud. It generates test report for device tests, which includes detailed logs, HTTP commands, and metadata. (Read more about Kobiton here: https://kobiton.com/)

One good feature of this platform is that it supports parallel execution of test scripts. In this blog post we are going to describe the process of executing test scripts in a parallel way.

 

Set up the environment and test scripts

 

First, you have to login on Kobiton, and get the automation settings, i.e. the desired capabilities for the devices on which you will run your test scripts. Put them into your code like in the following picture.

 

Put the automation settings into the code

 

In order to shorten the code, we are going to make the name of the test, device name and platform version dynamic. In the environment variables, when setting the driver, we pass as parameter the name of the test as sessionName capability, the chosen device name as a deviceName capability, and version of the chosen device as platformVersion capability.

In the test scripts, these parameters are passed with the annotation @Parameters, on which we will assign value from the TestNG configuration .xml file (below).

 

Assign value from the TestNG configuration .xml file

 

Executing test scripts

 

For the test scripts execution we should create TestNG configuration .xml file in our project. The .xml file should contain a suite of the tests that we want to execute in parallel. The test should have name and parameters such as device and version for the chosen device against which the tests will be executed which we pass when we set the driver, as mentioned above.

 

Automated Parallel Testing of Mobile Applications on Kobiton using Appium, Java and TestNG

 

Execution results in Kobiton

 

After the tests have started executing, we log in into our Kobiton account and check if the sessions are finished.

On the picture below, it is clear to see that the test scripts have the same start time indicating successful parallel execution of three test scripts on three different devices.

 

Parallel execution of three test scripts on three different devices

 

Dragana Todorchevska

Technical Consultant