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 onListeners
script. - The actual custom keyword is:
startInstalledApplication
incom.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 (usingappPackage
andappAcvitity
capabilities) in the current device throughdeviceInformation
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 myListeners
script belongs to Test Suite execution phase), Katalon Studio can start an existing application in the device and furtherMobile
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)