# Get the version of the mobile application that will be tested

**URL:** <https://forum.katalon.com/t/get-the-version-of-the-mobile-application-that-will-be-tested/103720>\
**Category:** Mobile Testing\
**Tags:** mobile, mobile-testing, katalon-studio\
**Created:** [November 7, 2023, 9:54am UTC](https://forum.katalon.com/t/get-the-version-of-the-mobile-application-that-will-be-tested/103720 "2023-11-07T09:54:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![msuryana45](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/msuryana45/32/23870_2.png) [@msuryana45](https://forum.katalon.com/u/msuryana45)\
**Post date:** [November 7, 2023, 9:54am UTC](https://forum.katalon.com/t/get-the-version-of-the-mobile-application-that-will-be-tested/103720/1 "2023-11-07T09:54:22Z")

</div>

Hi everyone

Is there a way or course of action to test the mobile version of the app?  
the case is like this: “I want to run the test in v1.1 with step A, and if version is v2.0 I want to run the test with step B”  
is there a way for this, with installed app version parameters?

---

<div class="post-metadata">

**Author:** ![Elly\_Tran](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/elly_tran/32/21874_2.png) [@Elly\_Tran](https://forum.katalon.com/u/Elly_Tran)\
**Post date:** [November 8, 2023, 7:00am UTC](https://forum.katalon.com/t/get-the-version-of-the-mobile-application-that-will-be-tested/103720/2 "2023-11-08T07:00:17Z")

</div>

Can anyone help? I think it will require some logics here

---

<div class="post-metadata">

**Author:** ![bharathi.a](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/bharathi.a/32/24695_2.png) [@bharathi.a](https://forum.katalon.com/u/bharathi.a)\
**Post date:** [November 8, 2023, 1:14pm UTC](https://forum.katalon.com/t/get-the-version-of-the-mobile-application-that-will-be-tested/103720/3 "2023-11-08T13:14:51Z")

</div>

Hi @msuryana45  
welcome to katalon community

**correct me if I’m wrong**

1. you created a test script for v1.1
2. you are referring to the apk v1.1 for execution
3. you are running the test script
4. got updated APK v2.0
5. you are referring to the apk v2.0 for execution
6. you are running the test script in v2.0

then there is no need to refer the app version to be validated and execute the test script

if you have a scenario like that then please proceed with the updated apk alone and keep the script designed for v1.1 for testing backward compatibility.

for you case please do a smoke test on both the applications and check there is any mentioning of apk version inside the application

if there is any fetch the version from the application and use if(condition){} else {} and based on the text in the version you can proceed to do your execution.

---

<div class="post-metadata">

**Author:** ![depapp](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/depapp/32/29178_2.png) [@depapp](https://forum.katalon.com/u/depapp)\
**Post date:** [October 9, 2026, 11:07am UTC](https://forum.katalon.com/t/get-the-version-of-the-mobile-application-that-will-be-tested/103720/4 "2026-10-09T11:07:10Z")

</div>

hi @msuryana45

you can read the installed version at runtime and branch on it. android, right after startApplication:

```groovy
def driver = MobileDriverFactory.getDriver()
String dump = driver.executeScript('mobile: shell', [command: 'dumpsys', args: ['package', 'com.your.app']])
String version = (dump =~ /versionName=(\S+)/)[0][1]
if (version.startsWith('1.')) { stepA() } else { stepB() }

```

ios (xcuitest) does not expose versionName through the driver, so read it from the ipa before the run: `unzip -p app.ipa 'Payload/*.app/Info.plist' | plutil -extract CFBundleShortVersionString raw -o - -` and pass it in as a GlobalVariable, or ask the app to show it in a settings screen you can getText from.

to keep the test cases clean i would wrap the two flows in callTestCase and keep the version check in one place (a listener that sets GlobalVariable.appVersion in @BeforeTestSuite), so individual test cases just check the global.

---

<div class="post-metadata">

**Author:** ![arvind.choudhary](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/arvind.choudhary/32/33165_2.png) [@arvind.choudhary](https://forum.katalon.com/u/arvind.choudhary)\
**Post date:** [October 10, 2026, 7:18am UTC](https://forum.katalon.com/t/get-the-version-of-the-mobile-application-that-will-be-tested/103720/5 "2026-10-10T07:18:32Z")

</div>

Hi @msuryana45,

Even before run time as well you can get the details, so there are 2 options to get the details  
Option 1: Read the installed version at runtime (Android) ( already shared by Depa)  
Option 2: Read the version from the build file (Android and iOS), find the details below

Read it before the run and pass it in as a Global Variable:

- Android: `aapt dump badging app.apk | grep versionName`
- iOS: `unzip -p app.ipa 'Payload/*.app/Info.plist' | plutil -extract CFBundleShortVersionString raw -o - -`

Then pass it in through your execution profile or the Katalon CLI (`-g_appVersion="2.0"`). Since you already know which build you’re installing, this avoids relying on driver capabilities and works the same on both platforms.

**Branching on the version**

`if (GlobalVariable.appVersion.startsWith('1.')) { Mobile.callTestCase(findTestCase('Test Cases/Flow_StepA_v1'), [:], FailureHandling.STOP_ON_FAILURE) } else { Mobile.callTestCase(findTestCase('Test Cases/Flow_StepB_v2'), [:], FailureHandling.STOP_ON_FAILURE) `  
`}`
