Repository problem after transition from Qt 4.x to Qt5

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
Andre
Posts: 3
Joined: Fri May 23, 2014 7:51 am

Repository problem after transition from Qt 4.x to Qt5

Post by Andre » Fri May 23, 2014 8:27 am

Hello everybody,

we have some serious problems with our test solutions after the transition of our project from Qt4.x to Qt5. None of the tests, which use elements of Qt, is working anymore.

The items seem to have different paths now and that's why the suites don't find them. Here are some examples of buttons and other elements in the repository:
Qt4: /form[@title~'^OurCompany\ OurProject\ -\ 14\.5\.0']/container[@controlid='59648']//?/container[@accessiblerole='Client']//button[@accessiblerole='ButtonMenu']/button[@accessiblerole='ButtonMenu']
Qt5: /form[@title~'^OurCompany\ OurProject\ -\ 14\.5\.0']/container[@controlid='59648']//container[@accessiblerole='Client']/container[@accessiblerole='Client']/separator/button[1]

Qt4: /form[@title='OurProjectShortName']/?/?/menuitem[@accessiblename='Mitarbeiter']
Qt5: /form[@title='OurProjectFullName']/?/?/menuitem[@accessiblename='Mitarbeiter']

Qt4: /form[@title~'^OurCompany\ OurProject\ -\ 14\.5\.0']//form[@accessiblerole='Application']/toolbar[@accessiblename='Suche']/button[@accessiblename='Suche ausführen']
Qt5: /form[@title~'^OurCompany\ OurProject\ -\ 14\.5\.0']/container[@controlid='59648']//toolbar[@accessiblename='Suche']/button[@accessiblename='Suche ausführen']

Qt4: /form[@title~'^OurCompany\ OurProject\ -\ 14\.5\.0']/container[@controlid='59648']//form[@accessiblerole='Application']//table[@accessiblerole='Table']/row[8]/cell[@accessiblename='Testmitarbeiter05']
Qt5: /form[@title~'^OurCompany\ OurProject\ -\ 14\.5\.0']/container[@controlid='59648']//button[@accessiblerole='SplitButton']/table[@accessiblerole='Table']/cell[@accessiblename='Testmitarbeiter05']

Qt4: /form[@title~'^OurCompany\ OurProject\ -\ 14\.5\.0']/container[@controlid='59648']//form[@accessiblerole='Application']/?/?/button[@accessiblerole='SplitButton']/container[@accessiblehelp~'^<html><head/><body><p>Die']/table[@accessiblerole='Table']/?/?/cell[@accessiblename='Testkunde02']
Qt5: /form[@title~'^OurCompany\ OurProject\ -\ 14\.5\.0']/container[@controlid='59648']//button[@accessiblerole='SplitButton']/table[@accessiblerole='Table']/cell[@accessiblename='Testkunde02']

Qt4: /form[@title='OurProjectShortName']/?/?/menuitem[@accessiblename='Kunde öffnen']
Qt5: /form[@title='OurProjectFullName']/?/?/menuitem[@accessiblename='Kunde öffnen']
Is there a (simple, fast, automatic) way to "fix" these paths, so the suites will find the items again in Qt5? Editing the paths manually, moving the items to another base or record them from scratch works of course, but would actually take too much time.

Unfortunately I couldn't get one of our developers to check this yet.

Thanks in advance!

mzperix
Posts: 137
Joined: Fri Apr 06, 2012 12:19 pm

Re: Repository problem after transition from Qt 4.x to Qt5

Post by mzperix » Mon May 26, 2014 11:01 am

Hi,

Since the ranorex repository is based on an xml file, just open it in a normal text editor (I use notepad++), and do a find-replace.

Most editors (like notepad++) are capadle to use regexp in them if the basic method to find the proper elements to change is not working.

Best Regards,
Zoltan

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

Re: Repository problem after transition from Qt 4.x to Qt5

Post by krstcs » Tue May 27, 2014 2:15 pm

I agree with Zoltan. Try a good, full-featured text editor like Notepad++ (I use it too, it is great). The XML is pretty easy to edit using find-replace.

Also, if you aren't using a versioning system for you code (you should be... :D ), make a backup copy of the original before you start, just in case.
Shortcuts usually aren't...

Andre
Posts: 3
Joined: Fri May 23, 2014 7:51 am

Re: Repository problem after transition from Qt 4.x to Qt5

Post by Andre » Tue Jun 03, 2014 1:04 pm

Thank you very much!

Unfortunately the issue is more complicated. Replacing the path (or parts of it) only helps in a few cases.
Many items have completely different paths now or even different accessible roles. This means, that we can't simply change the path for every item, e.g. from "base/qt4path/item" to "base/qt5path/item". That does not work respectively is not possible.

As an example, please see the screenshots for one and the same combobox:
combobox_spy_qt4.png
Combobox in Qt4
combobox_spy_qt4.png (45.13 KiB) Viewed 1232 times
combobox_spy_qt5.png
Combobox in Qt5
combobox_spy_qt5.png (45.72 KiB) Viewed 1232 times
You will notice, that simply deleting or replacing a part of the path would not work.

Currently the only option we see is to either record the complete repository again or to manually edit every single Qt4 item.

:arrow: What we would actually need is an automatic function like "Check Qt4 path and item - find item in Qt5 - fix path and item in repository".

Anyone else with such problems or any ideas?

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

Re: Repository problem after transition from Qt 4.x to Qt5

Post by krstcs » Tue Jun 03, 2014 1:37 pm

I would humbly suggest that you have a lot of work ahead of you. There is no way for this to be done currently inside Ranorex. And I doubt that something like this will be implemented because there are too many things that would have to be accounted for. A human is much better at this type of deductive reasoning.

You could use the search function in the repository and go through each item and change it. Either that or create a new repository and spy out all of the items again. Either way you will need to verify the elements are correct.
Shortcuts usually aren't...

mzperix
Posts: 137
Joined: Fri Apr 06, 2012 12:19 pm

Re: Repository problem after transition from Qt 4.x to Qt5

Post by mzperix » Tue Jun 03, 2014 2:32 pm

Hi Andre,

As I can see, you are using the Path Editor part of the Spy. Did you try to switch to the Browser & Results Tab?

There you can all of the diferent attirbutes Ranorex recognizes, and also, You can see the whole object structure that Ranorex identifies.

Try to compare the two object tree, and see what are the real differences. It could happen that the main reason Ranorex creates a different xpath, that there was a change in Ranorex xpath building algorithm. But there is a chance, that the same control has the same attributes, just ranorex chooses to use a different one.

Could you share us a snapshot or a screenshot of the Browser & Results tab?

Best Regards,
Zoltan

Andre
Posts: 3
Joined: Fri May 23, 2014 7:51 am

Re: Repository problem after transition from Qt 4.x to Qt5

Post by Andre » Wed Jun 11, 2014 7:39 am

Hi Zoltan,

after contacting Ranorex and testing some options, it seems there is really no other way than fixing all the test suites manually.

Anyway, the hint concerning the browser & result tab was very useful. It makes it quite easier and faster to find the correct items respectively paths.

Thanks again and I guess this topic can be considered as "resolved" (somehow).