How to launch an installed app using Katalon Studio


#1

Hi,
I have developed simple app hello world. I want to open that app when i launch my Katalon project and then click on button.
It is possible to do that using katalon studio?

thanks
–girija


#2

Did you mean mobile app? Generally, the answer is “Yes”. We need more information about your app, though.


#3

Yes i am mobile app. It is a Android app. Its a third party app so i don’t have access to code. It performs certain operations after clicking on those buttons.


#4

Suppose I write hello world Mobile app and i need to open that when i start my testing. Take example google map when i run my test project I have device connected and i need to start the map app which in on Android mobile


#5

You can do it if you know appPackage and appActivty desired capabilities of your app. These coupled capabilities used to identify the application in your device. There links will provide you an approach to get it:


http://toolsqa.com/mobile-automation/appium/how-to-find-apppackage-and-appactivity-for-apk-file/

Once you have this information, you need to build your own set of Appium desired capabilities and then use Katalon built-in interface to translate that session into Katalon-like session (Appium based of course).

Here is how this approach can be applied with Kobiton devices, of course it can be applied for local devices as well due to being the same context:


#6

Vinh thanks for the response. I will check it out and let you know how did it go.


#7

Hi Vinh

I am not able to find how to use appPackage and appActivity. I know using Android studio but I am not sure how to use here in Katalon. I didn’t find any example. I did looked at the both the links you sent but did not work for me. Do you have any other suggestion?


#8

I will provide to you an example soon :slight_smile:


#9

Hi there,

Attached is the sample project using the same approach I’ve given before. Before jumping into this project, make sure you read our approach carefully to understand why do we need to define these own capabilities by yourself, and have a brief read about Appium architecture

Looking at this project, some things to be noticed:

  • Appium is started manually with the help of AppiumServer utilitiy, and of course it will be terminated right after test execution. For the current instance of this project, these setup and teardown steps are placed on Listeners script.
  • The actual custom keyword is: startInstalledApplication in com.mobile.keywords package. Since Android and iOS are different mobile types, I separate them conditionally. This keyword also initialize necessary capabilities to start installed application (using appPackage and appAcvitity capabilities) in the current device through deviceInformation parameter.

Now let’s move on why we need to do this:

  • When using Start Application built-in keyword, Katalon Studio will automatically start an Appium server using random port. We need a static port here to hook into.
  • Starting installed application requires us to build Appium desired capabilities from scratch, so startInstalledApplication will do all these things.

References to get capabilities:
https://www.toolsqa.com/mobile-automation/appium/how-to-find-apppackage-and-appactivity-for-apk-file/
http://appium.io/docs/en/writing-running-appium/caps/

Usage in the test case Test Cases/Verify Correct Alarm Message:

  • Local variables should be created to define necessary capabilities:
  • In the test script, just replace Start Application keyword with the custom keyword along with its method signature:
    //Mobile.startApplication(appPath, false) CustomKeywords.'com.mobile.keywords.ApplicationBehavior.startInstalledApplication'("Android", deviceInformation, appPackage, appActivity)
    => Once Test Suite execution happens (because my Listeners script belongs to Test Suite execution phase), Katalon Studio can start an existing application in the device and further Mobile keywords don’t need to be maintained.

This is the most basic implementation to solve ‘How to launch an installed app using Katalon Studio’. Other adjustments can be made to applied for Test Case execution phase based on Listeners script.
mobile.zip (2.5 MB)


#10

The above comment has been reposted as a Tips and Tricks article.