Parameterise / replace object properties when using 2 apps for testing


I am currently creating some tests using an Android device. My tests should work across 2 apps. I noticed that when switching apps, due to the ‘resource-id’ differing I was getting errors when running my tests. I have tried to read up about global variables ect but I am unsure how to resolve this issue.

e.g of resource-id value = com.test.testapp10:id/design_menu_item_text - for app 1
com.testworld.testappnative10:id/design_menu_item_text - for app 2

Can anyone help ?

HI @leena.lad,

There is a post here that deals with a similar issue and may be helpful:

– Chris

@Chris_Trevarthen, thanks, I will take a look

@Chris_Trevarthen Hi, I have had a look and I am a bit confused about how to get this all setup.
Would I need to create 2 profiles which have the same value for the global variables ?

Hi @leena.lad,

Yes, you would create 2 profiles with the same variable included, e.g. packageName.

Then you can update your test objects to include the reference to the Global Variable like this:

or you can do it in the test scripts like so:

When you run the test, select the profile and the test should inject the appropriate package name to the object.

Hope this helps,