Join HeadSpin at Mobile World Congress Barcelona from 28 Feb - 2 Mar
Close
Integration of Robot Framework with HeadSpin

Robot Framework on the HeadSpin Platform

January 9, 2023
 by 
David BrokerDavid Broker
David Broker

Robot framework is a tool that is used by many different types of customers around the world for test automation. Many companies flock to robot frameworks because of its human-readable keywords. This framework can be used with many different programming languages. For more information about Robot Framework you can go to their website

We have integrated with different customers that use Robot Framework and this process is very straightforward. I will show how to do this and run Robot Framework tests on the HeadSpin platform. This is very straightforward because of the fact that Robot Framework uses Appium as the basis for the automation that it runs on mobile devices. 

In this blog we will be branching off another blog I found that helps setup Robot Framework to run tests in your local environment. This can be found here

The blog has a part two in which they actually run tests on a local app. I will be modifying these scripts to run on the HeadSpin platform and will be using the app that they provided. All of the unmodified scripts and apk files can be found there or on their GitHub repository. 

The first part that we will take care of is to upload the apk to the android device we are wanting to use. We can use Appium, rest api or the drag and drop menu. For this blog since it is a proof of concept, we will just use the drag and drop menu to upload the Sample Android App Login Test_v4.0_apkpure.com.apk to the android device you will be connecting to. After the installation is complete, we will release the device and make some modifications in the test file.

Execute automated Android app testing on real devices worldwide to build high-performing Android apps. Learn more.

With the test file that is created in the second part of the blog or the test.robot file from the github repository we will change the server name, the device name, and add the UUID to the desired capabilities. Additionally, we will remove the app capability. Find the android device you installed the apk on and gather the above information. We will then enter it into our script so it will look something like this 


${APPIUM_SERVER}	
https://dev-us-mv-0.headspin.io:3012/v0//wd/hub
${PLATFORM_NAME} Android
${DEVICE_NAME}	Pixel 4 XL
${APP_PACKAGE}	com.loginmodule.learning
${APP_ACTIVITY}    
com.loginmodule.learning.activities.LoginActivity
${UUID}    9A281FFBA003YA

This change will make it so that it runs on the platform. From the location of the file now you can run robot test.robot or whatever your test name is called. You should be able to view the test executing in the HeadSpin platform. The only next thing to do is to add HeadSpin specific desired capabilities to better interact with the platform through Robot Framework. One example that we can add is the ability to set the capture capability. To do this we can just add it directly to the capabilities section of the script just as we would with Appium. Below is an example


Launch Mobile Application
	Open Application	${APPIUM_SERVER}
	...    platformName=${PLATFORM_NAME}
	...    deviceName=${DEVICE_NAME}
	...    appPackage=${APP_PACKAGE}
	...    appActivity=${APP_ACTIVITY}
	...    automationName=UiAutomator2
	...    udid=${UUID}
	...    headspin:capture=True

Now you should be able to run Robot Framework Scripts on the platform and see the benefit of both Robot Framework as well as the HeadSpin Platform. 

Robot Framework on the HeadSpin Platform

4 Parts