Same test case different envirnment

Experiences, small talk, and other automation gossip.
Romarijo
Posts: 1
Joined: Sat Apr 08, 2017 9:05 am

Same test case different envirnment

Post by Romarijo » Sat Apr 08, 2017 9:17 am

Hey there. I am working on project with your product and I got some difficulties. The main thing is our product can be lunched through browser or through desktop one app but its kinda same because it lunch it as page just in other environment. The thing is if I write one test case fro browser lets say FF and i want it to use for the desktop app we get problem with base-adapter in paths. ALL path are identical only adapter different. Is possible to use the same test case in both with some kinda parameters or something ? I guess in code modules it might be possible but then you would not really use any repositories and it would be bad practice. ANY suggestion? its kinda code duplication with slight different so tho i would ask about it... Thanks for respons

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

Re: Same test case different envirnment

Post by odklizec » Mon Apr 10, 2017 12:16 pm

Hi,

Could you please post a Ranorex snapshot (not screenshot) taken both in browser and desktop mode? It may be possible that your problem is solvable by a simple xpath change in repository. But it's pretty hard to suggest something reliable without seeing at least the Ranorex snapshot and an example of problematic xpath. Thanks.
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

McTurtle
Posts: 191
Joined: Thu Feb 23, 2017 10:37 am
Location: Benedikt, Slovenia

Re: Same test case different envirnment

Post by McTurtle » Mon Apr 10, 2017 12:17 pm

Hello Romarijo,

You could add an additional /(slash) in front of the DOM object. I have tested it on the Google search windows that I have opened in Firefox and later in Eclipse. The full path to the Google search window is minimally changed and now works in Firefox and in Eclipse despite the fact that Eclipse has some layers before you even get to the built-in browser.

The path before: /dom[@caption='Google']//input[#'lst-ib']
The path after: //dom[@caption='Google']//input[#'lst-ib']

However, there is a catch. Because of the double slash Ranorex will search the whole tree of the host for the dom. Meaning, all open applications. This could have a performance impact.

For more info please see: http://www.ranorex.com/support/user-gui ... xpath.html

Another possibility would be to record two repositories, one for the browser and one for the desktop app. This would not impact your performance but it is more work for you.

Please let me know if this helped.

Regards,
McTurtle

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Same test case different envirnment

Post by Support Team » Mon Apr 10, 2017 9:57 pm

McTurtle wrote://dom[@caption='Google']//input[#'lst-ib']
That's a quite dangerous path, I would refrain from using that. "//" at the beginning of an XPath (or RanoreXPath) means "search everything(!)", i.e the whole element tree" which could virtually take forever...

In case only the adapter part is different, you can use a "*" instead of the "dom" which is a placeholder for "any adapter". Without seeing a Ranorex snapshot, I can't say for sure that this will work, though...

Regards,
Alex
Ranorex Team
.
Image