So, is there anyway to create global variables for mobile testing? I’ve got the start application step, but what I’d really like to do is 1 - set it to where my CI/CD doesn’t pull the apk from my local machine and 2 - be able to change global profiles in mobile like I do in web testing. Any tips, tricks, clues?! Thanks!!
Hi @Amanda_Perkins1,
On the whole, Global Variables (aka Execution Profiles) should behave the same way in Web and Mobile tests:
https://docs.katalon.com/katalon-studio/docs/execution-profile-v54.html
As for not hardcoding paths to the .apk file so that you can use your tests in CI, I use the RunConfiguration.getProjectDir()
to get the path of the current Katalon test. As a first step in my CI job, I pull in a pre-built .apk to a directory within the Katalon project, e.g. builds
:
import com.kms.katalon.core.configuration.RunConfiguration
String filePath = RunConfiguration.getProjectDir() + "/builds/myApp.apk"
MobileBuiltInKeywords.startApplication(filePath, false);
Alternatively, you could use the Execution Profiles to set up a profile for CI test environments, including a filePath
variable that you can set as the absolute path on your CI system to the .apk file. Then you can reference the variable in your tests:
import internal.GlobalVariable
String filePath = GlobalVariable.filePath
MobileBuiltInKeywords.startApplication(filePath, false);
Hope this helps,
Chris
Thanks @Chris_Trevarthen. I was able to set up the Execution Profiles in just the way I wanted. The info on not hard coding apk paths is going to come in very handy! I appreciate the help!