Name Mapping - Extended Find - Changing parent URL
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Name Mapping - Extended Find - Changing parent URL
Hi,
I have a web page deployed to two different environment.
The source codes are exactly the same.
When I write JS script for www.test.com, in NameMapping section -- Mapped Objects window, I can see pageWWWTestCom under browser. The same thing when I write script for www.prod.com.
The children (panel, panel (1), etc) of that pageWWWTestCom are the same as pageWWWProdCom.
Currently, after I finish writing JS script for www.test.com and it runs fine in www.test.com , I need to change the aliases in my script so I can re-use it and run it in www.prod.com
That takes time.
I am just wondering, why can't we use extended find and drag all those children (panel, panel(1), etc) directly to be under browser, so I don't need to change the aliases in my script. Because all the children are the same, the only difference is just the parent URL.
Is there any other good method that I can use , so I don't need to keep changing the aliases in my script every time the parent URL change ?
Thank You.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Presume you must be using the URL as an identification property for the page object?
If it is the only browser open during your test, you should be able to simply wildcard it out.
So instead of the property ID being "www.TEST.com" or "www.PROD.com" change it to "www.*.com". Or simply "*". Which means it would run on any site.
Or you could store it as a variable. Read it in from an INI file of some description. Include it in the input if you use data and/or keyword driven tests (that's what I do). If there is anything else in the deployment which changes, and can be accessed before starting the site, you could inspect that and use the result to determine the URL path to use.
Probably quite a few options.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can use Project variable as your identification property. So you can set your URL whatever you want for different environments.
For this, Instead of constants you should select project variable in Edit identification properties.
This needs to be set before you access the particular object.
Thanks
Shankar R
LinkedIn | CG-VAK Software | Bitbucket | shankarr.75@gmail.com
“You must expect great things from you, before you can do them”- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
All ideas presented are very good ideas, depending upon what you want to do. That's, again, one of the bonuses of using NameMapping in that you can map something like your main page URL to be dynamically determined either using a wildcard, a project variable, using a conditional mapping, etc. Anyone of those ways would allow you to test, regardless of environment, without having to change your Alias... a simple commandline switch or, as mentioned, INI configuration could trigger the use of a different environment and then the Alias could account for it.
Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----
Why automate? I do automated testing because there's only so much a human being can do and remain healthy. Sleep is a requirement. So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.
Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks All.
I managed to do "Extended Find" , so I just skip the pageURL and I put all elements directly under Sys-Browser.
I also tried to wildcard the URL , www.*.com.
The problem with those solutions is TC tends to take much more time and the playback process becomes much much slower when I have heaps of open Chrome tabs. I think TC doesn't know in which tab does this web element sit and it needs to search in each and every tab. Sometimes it took 5 minutes just to find the box and it returns
Searching for the mapped object "WarningBox" took a long time. This happened because the sought-for object has the Extended Find attribute enabled, and the test engine searched for this object on all levels down the object hierarchy.
To speed up the search and improve the test performance, add more parent objects of this object to the Mapped Objects tree of Name Mapping.
Anyway, thanks for all the suggestions
