Use Ranorex Repository or XPaths in variables?

Class library usage, coding and language questions.
tman786
Posts: 3
Joined: Wed Oct 23, 2013 4:41 pm

Use Ranorex Repository or XPaths in variables?

Post by tman786 » Wed Jan 29, 2014 12:51 pm

Hi,

I am new to Ranorex but have substantial experience using QTP.

I am in the process of creating a framework in C# and im currently storing xpaths in variables in a class file and using host.local.FindSingle<> statements to set references to an objects before performing actions against it.

What i would like to understand is the advantages of using the Ranorex repository feature over xpaths values in variables?

Also, how can the repostitory code for Ranorex be associated with a visual studio c# project.

I cant find a discussion on these, hence the reason for this post.

Thoughts, opinions and advance will be very appreciated.

Swisside
Posts: 92
Joined: Thu Oct 10, 2013 10:40 am

Re: Use Ranorex Repository or XPaths in variables?

Post by Swisside » Wed Jan 29, 2014 2:17 pm

Hi !

I cannot answer all your questions but regarding the use of the repository from my own experience I can say it reduces maintenance time significantly.

Let's say the path for an item you use many times in your tests changes, if you use the repository you only change the path once.

Cheers

Swiss
A simple thank you always does wonders !

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

Re: Use Ranorex Repository or XPaths in variables?

Post by krstcs » Wed Jan 29, 2014 2:52 pm

tman786 wrote:Hi,

I am new to Ranorex but have substantial experience using QTP.

I am in the process of creating a framework in C# and im currently storing xpaths in variables in a class file and using host.local.FindSingle<> statements to set references to an objects before performing actions against it.

What i would like to understand is the advantages of using the Ranorex repository feature over xpaths values in variables?

Also, how can the repostitory code for Ranorex be associated with a visual studio c# project.

I cant find a discussion on these, hence the reason for this post.

Thoughts, opinions and advance will be very appreciated.

First, I would say that if you are using Ranorex, the framework is already pretty much done. You will probably need to do some minor coding in .NET, but you won't need to create fixtures and such from scratch. You can just focus on creating test modules and stringing them together in cases.

Second, as Swiss said, the repository allows you to manipulate objects in a way that keeps you from having to change test scripts.

The test script tells Ranorex WHAT to do, the Repository tells Ranorex what UI object to take the action ON. The script defines business logic, the Repository defines the location of the object (relative to other objects, not to screen position). So, as long as your business logic (the path through the application) doesn't change, the scripts don't change, but if the developers change the objects, you just need to change the repository path.


Having said that, there are a few members on the forum that do use a more static structure with "Find<T>()" and giving the XPath in the scripts. They tend to use Visual Studio, and just import references to Ranorex in their VS projects. Everything in Ranorex is a .NET object, so you can create your own repository in VS if you want although, I would suggest not re-inventing the wheel, since Ranorex already has it laid out for you.

Much of it depends on the technical capabilities of your testers/test developers and the desires for flexibility versus maintainability (although I find you get both with Ranorex Studio and the repository, so your mileage may vary).

Hope that helps.
Shortcuts usually aren't...