Can one recording work on two applications?

Mobile Testing, Android App Testing.
tvu
Posts: 195
Joined: Tue Apr 07, 2015 10:47 pm

Can one recording work on two applications?

Post by tvu » Tue Sep 22, 2015 7:48 pm

Hello,

I was wondering if there is a way we can have one recording work on two different mobile application platform, but not at the same time of course. We have a mobile app the runs on iOS and Android. Visually, the layout and flow are exactly the same, but the Xpath for any particular item is not.

Lets assume I built out the item repository to have it organize exactly the same for both platform. Something like this:

A) iOSAppRepo (MobileApp)
a) LoginPage (Container)
1) EmailField (text)
2) PasswordField (text)
3) SignInButton (button)

B) AndroidAppRepo (MobileApp)
a) LoginPage (Container)
1) EmailField (text)
2) PasswordField (text)
3) SignInButton (button)

Can I then have a script that does something like this?

Code: Select all

static var repo;
if (mobileAppGlobalVariable == "iOSApp")
   repo = new iOSAppRepo();
else
   repo = new AndroidAppRepo();
..... then have my script do something like this:

Code: Select all

repo.LoginPage.EmailField.Element.SetAttribute("Text", myEmailAddress);
repo.LoginPage.PasswordField.Element.SetAttribute("Text", myPassword);
repo.LoginPage.SignInButton.Touch();
If this is possible, where should I put that "IF" statement since the repo gets assigned in the automatically generated code by Ranorex. Maybe in the Init() section of the User code? What are some of the issue I should be concern with?

If this is NOT possible, whats the best way to tackle developing tests for two applications where the UI is exactly the same? It would seem very tedious for me to recreate the item repository and recreate all the recordings.

Thanks.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Can one recording work on two applications?

Post by Support Team » Thu Sep 24, 2015 2:28 pm

Hi tvu,

I’m afraid that this intention is not easy to implement since the RanoreXPath is different on both devices.
Using multiple repositories is also not possible. Every Repository is represented by a C# class and it contains all information about the repository items itself.

One way to achieve this plan would be using unique ID’s to identify your UI elements and to adapt the path that it will fit for both applications. This allows you to store all elements in a single repository.

Personally, I’d separate both tests because a single modification in the android app will cause failures in the iOS app and vice versa.

Regards,
Markus (S)
.
Image

tvu
Posts: 195
Joined: Tue Apr 07, 2015 10:47 pm

Re: Can one recording work on two applications?

Post by tvu » Fri Sep 25, 2015 1:46 am

Thanks for the advice Markus.