Rooted Folder with the same name, but different Xpaths

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
tvu
Posts: 195
Joined: Tue Apr 07, 2015 10:47 pm

Rooted Folder with the same name, but different Xpaths

Post by tvu » Thu Apr 06, 2017 7:00 pm

Hello everyone!

We build our automation to support the current version of our app as well as the version we are still developing. From time to time, we come across changes to a Repo Item for the un-released version where the Xpath can't be reconcile into one Repo Item. When that happens, we create two Repo Items and use an if statement in our user code block to determine which item to use.

Here's a simple example of a Repo Library structure:

Code: Select all

MobileApp
    LoginScreen (Rooted Folder)
        Buttons (Rooted Folder for current release version)
            SignInButton (Button Repo Item)
        ButtonsForNewVersion (Rooted Folder for un-release version)
            SignInButton (Button Repo Item) 
Let's assume that I can't just do a //button to find the SignInButton from the LoginScreen rooted folder. Let's also assume that Xpath for the Buttons and Buttons2 rooted folders are vastly different and can't be combine into one rooted folder.

Currently, we do something like this:

Code: Select all

if (repo.versionNumberForUUT > repo.currentReleaseVersionNumber)
{
    repo.MobileApp.LoginScreen.ButtonsForNewVersion.SignInButton.Touch();
}
else
{
    repo.MobileApp.LoginScreen.Buttons.SignInButton.Touch();
}
I don't think it's possible, but I would like to achieve something like this:

Code: Select all

MobileApp
    LoginScreen (Rooted Folder)
        Buttons (//container[@id=$currentReleaseVersionNumber)
            SignInButton (Button Repo Item)
        Buttons (//container[@id>currentReleaseVersionNumber)
            SignInButton (Button Repo Item) 
And then just use:

Code: Select all

repo.MobileApp.LoginScreen.Buttons.SignInButton.Touch();
The ultimate goal is to move away from the If statements in the code and handle it via the Repo Library.

Thanks in advance.

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Rooted Folder with the same name, but different Xpaths

Post by krstcs » Thu Apr 06, 2017 7:42 pm

You are either going to have to continue using the ifs, or you can do what I do and make a new branch for each new version of the SUT.

FIRST: You need to be using a code versioning system like git, svn, or TFS, regardless of which way you go.

I have 3 feature branches in my git repo, corresponding to the 3 primary stacks that we have in our test environment:
1. MIRROR - This branch has my code that works on the current production version of the SUT. (say 1.2.0)
2. PATCH - This branch has my code that works on the next BUG PATCH release of the SUT. (1.2.1)
3. PREVIEW - This branch has my code that works on the next FEATURE release of the SUT. (1.3.0)

When we move patch or preview code into production with a new release, I just merge that branch up into mirror (and into patch also, if it is preview that got released).

This way you can make changes in one branch that do not impact the others. This is the easiest, and in my opinion, the best, way to handle this type of situation.
Shortcuts usually aren't...

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

Re: Rooted Folder with the same name, but different Xpaths

Post by tvu » Thu Apr 06, 2017 11:02 pm

Thanks for the suggestion krtscs.

My hesitation is that we use Perforce for code versioning and Ranorex doesn't support that. We always have issues with the rxtst file when we try to merge. We don't have any issues if a Dev simply pulls the latest, add a test case and then checks in. But, if two Devs are making changes then we always run into trouble.

For example,
1. Each Dev1 and Dev 2 pulls the latest.
2. Dev 1 modifies an existing test case and checks in the change.
3. Dev 2 adds a new test cases.
4. Dev 2 pulls the latest to get Dev 1's changes.

We always get conflicts when Dev 2 pulls the latest. Something always goes wrong no matter how carefully we go through the conflicts. We wouldn't be able to open the test suite file after the merge because of some errors. I would say the majority of the time, we have to recreate Dev 2's changes after pulling Dev 1's.

I highly suspect that Ranorex is assigning the same test case ID #s for Dev 1's change and Dev 2's new test case. But, it's hard to be sure because our RXTST file has 50K lines.

Maybe you don't run into this problem since you use GIT and they have GIT integration. You're suggestion for my issue would then be the ideal solution, but we haven't had much luck in merging changes.

I have another post asking for best practice guidelines when working in teams, but I never received a complete answer. You made some clarifications for me on that post, but we still have issues. Thanks again for that!

Here's the other post:
http://www.ranorex.com/forum/best-pract ... 10140.html

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Rooted Folder with the same name, but different Xpaths

Post by krstcs » Fri Apr 07, 2017 1:34 pm

Yeah, I don't have any knowledge of Perforce. I use git and it has it's own issues with Ranorex's XML files. Ranorex is changing the structure to make it easier for merging, but there can still be issues.

I've just had to learn what to look for and what to correct when I get conflicts (which are not often since I'm the only one on the project, but it does happen).
Shortcuts usually aren't...

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

Re: Rooted Folder with the same name, but different Xpaths

Post by tvu » Fri Apr 07, 2017 5:48 pm

I have high hopes for Ranorex 7. We have some outstanding issues that supposed to be fix in this version. Unfortunately, there are a few breaking changes for us so we haven't attempted to upgrade yet. We use nested test cases extensively so I'm curious how these Smart Folders are going to affect us.

We have several Devs working on a test solution so merge conflicts are a big headache for us. Hopefully Ranorex 7 new structure would help with that. If not, we were planning on creating multiple projects for a test solution. There will be a single library project that contains all the repo items and recordings. Then there will be multiple projects where each project have test cases for a feature. We would then have only one Dev working on an individual feature project. It will make it more cumbersome to run a full regression, but it should take care of our merging issue.

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Rooted Folder with the same name, but different Xpaths

Post by krstcs » Fri Apr 07, 2017 6:19 pm

I'm in the same boat as far as Ranorex 7 and nested test cases. We can't move forward with 7 as long as there isn't a way to report on each nested item's status individually. My guess is that that won't change though, I think they spent too much time and money on changing it to let us go back. Which means 6 may be the last version I use, unfortunately.

I already use multiple projects, but I have one CORE project that holds all the common modules. My other projects hold the actual test suites. But, again, I'm the lone wolf for desktop test automation around here (we use Selenium for web due to high Mac use from customers).

My tests are very dynamic, I re-build the SQL queries in each test case's data connector at runtime to include filter information from parent test cases so the system knows when to run certain cases based on the data passed in. My hope was that the upgrades in 7 for global data connectors and the potential for conditional module execution would allow us to not have to do this manually, but with the other test case issue, it's probably not going to matter.

Such is life. :D

Hope you get it figured out.
Shortcuts usually aren't...

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

Re: Rooted Folder with the same name, but different Xpaths

Post by tvu » Fri Apr 07, 2017 6:32 pm

I have a custom code module that enables / disable nest test cases that takes care of the conditional module execution. Based on a condition, it would enable a child test case and disable another.

For our iOS app, the iPhone and iPad generally have the same flow when doing something. UI might be different, but maybe the flow is slightly off. I generally like to write one test case that can run on both the iPhone and iPad. So when the flow is a little different, I use the method I mentioned above. If it's the iPad, run this else run that. Works well for us, but our setup isn't as dynamic as yours so it might not work for you.

User avatar
Stub
Posts: 173
Joined: Fri Jul 15, 2016 1:35 pm

Re: Rooted Folder with the same name, but different Xpaths

Post by Stub » Mon Apr 10, 2017 8:08 am

krstcs wrote:Yeah, I don't have any knowledge of Perforce. I use git and it has it's own issues with Ranorex's XML files.
FWIW we use Subversion here, and it too has issues with XML files in general. We've learned to apply Subversion locks to those files so that only one developer can change them. I've applied locks to the Ranorex Repository files, but hadn't though to do the same to the .rxtst files. That's useful to know, thanks.

User avatar
Product Management
Certified Professional
Certified Professional
Posts: 11
Joined: Thu Sep 07, 2017 3:09 pm

Re: Rooted Folder with the same name, but different Xpaths

Post by Product Management » Wed Sep 20, 2017 9:44 am

krstcs wrote:I'm in the same boat as far as Ranorex 7 and nested test cases. We can't move forward with 7 as long as there isn't a way to report on each nested item's status individually..
Hello,

I am happy to tell you that we have provided a way so that test cases and smart folders are counted together again in the report.
You can find a detailed description in the following post: https://www.ranorex.com/forum/ranorex-7 ... tml#p45644

Kind regards,
Ranorex Product Management Team