Handling the changes on ControlId for regression testing

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
JanneSeppala
Posts: 3
Joined: Fri Apr 06, 2018 9:26 am

Handling the changes on ControlId for regression testing

Post by JanneSeppala » Fri Apr 06, 2018 9:58 am

Hello.

We are currently evaluating Ranorex to be used for the regression testing of our large Clarion application.

Is there some way in Ranorex to handle the changes on the ControlIds between f.ex. different versions of the AUT?

Our scenario is as follows: Currently, the ControlIds are automatically generated by Clarion templates. This seems to result a problem in running a test case on different versions of the AUT; if a form changes between the versions (ie. f.ex. a new control is added on the form), that changes the ControlIds on the form (in our case, the rest of the conrol ids (at least) on the form in question are incremented) --> the test case fails when run on a differet version of the AUT, than which version the test case was created from.

Is there a way to handle this kind of changes, either by the Ranorex Studio itself, or by coding f. ex. some kind of a conversion script for the ids, which would check the id differences?

Thanks a lot in advance,
Janne
Attachments
Snapshots.zip
Snaphots
(194.17 KiB) Downloaded 13 times
Last edited by JanneSeppala on Fri Apr 06, 2018 12:45 pm, edited 1 time in total.

EugeneMkv
Posts: 25
Joined: Thu Nov 30, 2017 3:52 pm

Re: Handling the changes on ControlId for regression testing

Post by EugeneMkv » Fri Apr 06, 2018 11:32 am

Are there any elements on the form which don't change and could be used as anchors?

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

Re: Handling the changes on ControlId for regression testing

Post by odklizec » Fri Apr 06, 2018 11:34 am

Hi,

Could you please post an example of xpath with original and changed IDs? Ideally, post a Ranorex snapshot (NOT screenshot) of the problematic element (both created before and after change).

Generally speaking, there is no other way than to stop using dynamic ID's. I would suggest to check this blog post about automating apps with dynamic IDs:
https://www.ranorex.com/blog/automated- ... namic-ids/

Basically, you must instruct Ranroex to ignore dynamic IDs (while recording/tracking) and instead prioritize other attributes. If the IDs contains both unique string and randomly generated number/string (e.g. ListBox_123456), you may still be able to use these IDs using regular expressions. So for example instead of xpath like this:
.//div[#'ListBox_123456']//div
You can use this:
.//div[@id~'ListBox']//div
But this approach may make your xpaths non-unique and therefore, you may need to add some additional attributes for unique element identification.
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

JanneSeppala
Posts: 3
Joined: Fri Apr 06, 2018 9:26 am

Re: Handling the changes on ControlId for regression testing

Post by JanneSeppala » Fri Apr 06, 2018 12:51 pm

Hello!

Snapshots added to the first post (Note: just a very small part of the application, similar problems in many places with various different controls).

in this example, we have an added button control in the new version.

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

Re: Handling the changes on ControlId for regression testing

Post by odklizec » Fri Apr 06, 2018 1:07 pm

Yes, it's exactly what I thought. Well, I have a very bad news for you. Clarion apps are pretty bad for automation, no matter which test automation tool you will use. We too have an app developed with Clarion and few months back I did POC test with Ranorex. Unfortunately, the app turned out to be pretty unautomatable via GUI. The only (partial) success was using GDI Capture List (as described here).

Clarion control IDs are useless and the only other usable info seems to be a part of Class attribute. But even with Class attribute, you will have to use regexes and they will not help much with unique element identification. Which means you can forget about simple Record&Replay without heavy manual editing of each recorded xpath. Additionally, in some cases, you may be completely unlucky to extract texts from certain Clarion controls (even RAW texts, using GDI Capture List).

All in all, it's possible to automate Clarion apps with Ranorex, but you should be prepared for heavy editing of everything you record. And because you will have to use a lot of manually added control indexes in the xpaths, you should be prepared for the need to update them from time to time, if the GUI changes significantly.

Here is an example xpath, which may help you to identify edit control (containing text 'Viljanen'), using label "Sukunimi:"...
/form[@title~'^Perustiedot\ -\ Käyttäjä:SY']/?/?/form[@title='Käyttäjätiedot']//element/text[@accessiblename='Sukunimi:']/parent::element/following-sibling::element[@class~'ClaEdit'][1]
Last edited by odklizec on Fri Apr 06, 2018 1:30 pm, edited 1 time in total.

JanneSeppala
Posts: 3
Joined: Fri Apr 06, 2018 9:26 am

Re: Handling the changes on ControlId for regression testing

Post by JanneSeppala » Fri Apr 06, 2018 1:18 pm

Hi,

ok, thank you very much for your help on this. We will continue discussion about wether or not proceeding with the pilot from now on.

- Janne

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

Re: Handling the changes on ControlId for regression testing

Post by odklizec » Fri Apr 06, 2018 1:32 pm

You are welcome. I've added a small xpath example in previous post, showing the approach you will have to use with Clarion elements. But as mentioned, it may not work in all cases and you may be unlucky to extract texts from some controls at all.
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