Namemapping nightmare
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Namemapping nightmare
I am new to Testcomplete and having trouble with namemapping. I am using Testcomplete to test a WPF based application. The issue is that UI on the application keeps changing, and each time I have to update the namemapp as well as the tests that use onscreen actions. This is a nightmare as it takes a lot of time, and most of my time is spend on updating namemapping and the tests.
1) Namemap is like a tree, so if something is added near the root then I need to remapp all the child nodes even when they did not change. There is no mechanism to copy paste the nodes or to insert a node in between the tree. Is there a workaround or feature to do this easily?
2) Also, even after updating the namemapping I need to update the refereneces in the tests and onscreen actions. Is there a better way to do it?
Is there a better alternative to namemapping or a better way to handle this scenario?
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
See TC help for more details, but as a quick example, using Extended Find (and don't forget about Simplified WPF Tree parameter in the project properties) you can name-map your
|- region
|- wrapper
|- button
|- wrapper
|- wrapper
|- name = "Button1"
tree as
|- region
|- button (*)
|- name = "Button1" (*)
(where (*) indicates items with the enabled Extended Find option. Also button object must have 'name = "Button1" object specified as its required child.). Actually, enabled Extended Find functions pretty like the implicit call to FindChild.
With the namemapping from above you may have an Alias like this:
Aliases.<appAndParentObjects>.region.button
which can be used in the test code with much more convenience.
Hope, the above will help...
/Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I took Jose's suggestion and now I am using a mixed approach.
1) For features in my application where UI keeps evolving I implemented a script to find UI objects and perform on screen actions.
2) For features that don't change that often, I use Namemapping.
I will gradually replace operations involving namemap with the script.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jose Pita | "R. Gratis If you decide to write script functions to find the objects for you, you can always move them out into a Script Extensions Runtime Object, which can make them much like Aliases in TestComplete. I've done this on a few different products to allow sharing the functions between multiple TestComplete Projects." Yesterday I was investigating this option but I found some forum entry saying that you can't debug \ catch errors from Script Extensions. Haven't tried it yet, but I don't think I'm willing to. |
I write in VBScript, so I use VBScript's native error handling mechanism to catch exceptions inside the Script Extension code. If an exception makes it through, it pops up an exception window during a TestComplete run. I can get the line number / unit in the Script Extension from the popup text, but that same information doesn't make it into the TestComplete log Call Stack, so if you're trying to fix an issue in an unattended test run that you can't replicate locally, it can be difficult. It certainly makes you write defensive code.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
HD | Thanks guys for helping me out. I took Jose's suggestion and now I am using a mixed approach. 1) For features in my application where UI keeps evolving I implemented a script to find UI objects and perform on screen actions. 2) For features that don't change that often, I use Namemapping. I will gradually replace operations involving namemap with the script. |
HD: one question.
Did you compare the speed of your automation test after applying "search" at step 1 above against the speed by using name mapping you implemented previously? Does "always search" slow down your test?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Specifically, if something fails, it will fail in the script routine at the line that's supposed to actually click the item.
Clicking on the failure in the test log WITHOUT this script will jump to the line in the keyword test that actually failed.
Clicking on the failure WITH the script just shows you the script line, which is very generic.
The log doesn't tell you what it was trying to click at the time...
It makes the tests a bit easier to write, but a lot harder to debug, as far as I can tell.
How did you all get around that?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Don't double-click on the log record but instead switch to the Call Stack pane of the log (usually it is below main log grid). Double-click on the call stack record will navigate you to the relevant line and this greatly simplifies debugging.
/Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Well, while I was trying to figure out what to do about this, I figured out some stuff about how to create custom messages using event handlers.
I now have messages that read: "Clicked <item identifier> " instead of "The window was clicked with the left mouse button"
And failures that read: "Failed to click <item identifier> " instead of "You tried to click something that doesn't exist."
Should make the failure logs a bit easier to follow, and using the stack to get back to the actual failing line item will make troubleshooting easier.
So... learned two things today, not just one. Thanks.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Greetings
I've recently encountered an issue with all of my namemapping becoming broken after some recent updates. It is doable to remap everything, (but it is a LOT!) - I stumbled upon this post and it sparked some ideas I have had in the past of using FindAll/FindChild to return a list of what elements are available. Then I can write functions to test those elements after I do a scan of the page.
After reading the suggestions above it seems that this is logical, but definately need a starting point.
Some of the elements I have name mapped are extremely long and this is going to require some thought.
An example is:
Aliases.browser.page.panelRoot.Section("TEST").Panel(0).Panel(0).Section(0).Panel(1).Panel(0).Panel(0).Panel(0).Panel("form_item_").Panel(0).Panel(0).Panel(0).Panel("form_item_test_name").FullName
Any advice is appreciated! Thanks
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
First of all....
.... what you showed is your Alias, not your mapping. There's a difference. The Alias has no need to be that long. you can collapse a LOT of those "panel" objects down in the Alias while preserving it in your mapping. That way, when you need to what you've currently described, you can move objects around in your mapping and preserve the Alias.
Second of all - FindAll/FindChild are good for occasional searches... but they are searches. NameMapping processing has a lot of optimization built into it so the recommended way is to map everything you can and use FindNNNN methods for those things that are variable enough (like tables of data that have variable length, etc) that make it cumbersome to map accurately.
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
One approach is to build and use Your own framework to access Your app's objects.
I only use name mapping and aliases for basic addressing - of the dialogs, but not for the hundreds and hundreds of fields thereon.
So, in Your framework, provide a dialog object and make use of an alias to access it. For the child controls, use Your own Control objects and for their addressing Your own addressing methods.
If data or functions are scattered to some technical ui objects, You can hide this inside Your control object.
This is some work to do, but it gives You a stable and maintainable result.
