Changing Ranorex Repository Programmatically

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
jannic
Posts: 4
Joined: Tue Apr 03, 2018 3:39 pm

Changing Ranorex Repository Programmatically

Post by jannic » Wed Apr 04, 2018 10:12 am

Hi,

we are currently using Ranorex 8.0.1 on Windows 10.
We want to use Ranorex for testing our web application.
Unfortunately, the web elements in this web application do not have fix ids and in most cases the web elements do not have an id at all.

I could define five different control types. For each I have defined a sort of RanoreXPath template.

For example, we have following text field:
1.jpg
Screenshot_Field_Example
1.jpg (5.92 KiB) Viewed 315 times

The corresponding template would be:

.//*//label[@innertext='Anrede']/../..//input
Anrede“ is in this case the label of the text field.
2.png
Screenshot_Ranorex_Repository
2.png (28.15 KiB) Viewed 315 times
If we look at the example again in the Ranorex Repository, I would like to just record a test and after that run a reorganization program, that would change the RanoreXPath as previously defined.

Program logic:
Look at the name (f_Anrede). f_ would mean we have to use this template .//*//label[@innertext='x']/../..//input. Now we would change ‘x’ to Anrede.

The problem is currently, that Ranorex says in their Repository that you cannot change this file.
// This file was automatically generated by RANOREX.
// DO NOT MODIFY THIS FILE! It is regenerated by the designer.
// All your modifications will be lost!
Is there a way to change the Ranorex Repository programmatically?

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3930
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Changing Ranorex Repository Programmatically

Post by odklizec » Wed Apr 04, 2018 11:58 am

Hi,

As far as I know, there is no programmatic way to change the repository according your need. And of course, you can't change the repository.cs file, because this file is autogenerated by Ranorex form rxrep file. What you can do is to open the rxrep file in an external editor (e.g. notepad++) and search and replace string you want to change. Of course, you can also write your own program to change the rxrep. Don't forget to save everything to version control system of your choice, before manually editing the rxrep file! ;)
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

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

Re: Changing Ranorex Repository Programmatically

Post by tvu » Thu Apr 05, 2018 12:22 am

Hi Jannic,

Maybe I am understanding this wrong, but why can't you use a repository variable and bind the value?

Code: Select all

.//*//label[@innertext=$labelValue]/../..//input
When you use this repository item in a recording, the labelValue parameter will automatically be added a recording parameter. You would then just bind that value on the test case / smart folder level.

Could you provide snapshots (not images) showing the different controls your are trying to dynamically use?

jannic
Posts: 4
Joined: Tue Apr 03, 2018 3:39 pm

Re: Changing Ranorex Repository Programmatically

Post by jannic » Mon Apr 09, 2018 8:33 am

Hi,

thanks for the quick responses.
The solution from odklizec was suitable for us.

@tvu This will not work for us because we have five different "RanoreXPath templates" defined and the user who will record a test case does not want to change the RanoreXPath at all.

This post can be closed.
Thanks.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3930
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Changing Ranorex Repository Programmatically

Post by odklizec » Mon Apr 09, 2018 8:41 am

Hi,

I must agree with Tvu here. The best and most recommended way is using variables in xpath. Modifying rxrep file outside the Ranorex Studio should not be a standard procedure. You should not bend TA development process just because someone don't want to do or learn something new ;) TA is not about record&replay. In fact, record&replay should be just a helper, not the main way of TA development.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

jannic
Posts: 4
Joined: Tue Apr 03, 2018 3:39 pm

Re: Changing Ranorex Repository Programmatically

Post by jannic » Mon Apr 09, 2018 11:41 am

Hi,

I know that it's not the correct way. :wink:
Unfortunately, that is what our (small) company wants.
The person who will maintain the tests in Ranorex is a normal user without much IT knowledge.
They just want to record a test and that's it.

This is our first try for automated testing.
I think for the beginning this would be a good start.
If I would say this person must learn everything in the beginning, there will be a big chance, that we'll never start with automated testing.

Thanks for your advice 8)

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3930
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Changing Ranorex Repository Programmatically

Post by odklizec » Mon Apr 09, 2018 12:00 pm

Hi,

I understand your point. But the thing is, that once you start with record&replay only approach, you will soon hit the limits. Also, after each record&replay, someone (ideally, the same person who recorded test) should clean-up and reorganize recorded repo elements. Recording things without cleaning things up is a quick way to hell! Your tests will end-up with very messy repository.

In other words, recording tests without proper sanity and maintenance (which includes repository editing) will lead to very messy and non-functional (in long run) TA. And therefore, your TA attempt may end very soon too ;) I don't want to insult anyone, but assigning a non-technical person to TA is a first big mistake. Doing TA without technical skills (and at very least basic programming skills) is guaranteed way to failure. A TA person does not have to be a hardcore coder. But he/she should have a basic knowledge of creating conditions, loops, ability to edit things (with help of google), including knowledge how to save project to version control system and resolve possible conflicts.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

jannic
Posts: 4
Joined: Tue Apr 03, 2018 3:39 pm

Re: Changing Ranorex Repository Programmatically

Post by jannic » Mon Apr 09, 2018 12:13 pm

Hi,

in my next meeting with the responsibles I will tell them. I understand your points and hope the responsibles will too.

By the way I‘ve already told them the same weeks ago. Maybe after the ranorex community thinks in the same way the responsibles will change their mind regarding this issue.

Wish me luck :?