Forum Discussion

Colin_McCrae's avatar
Colin_McCrae
Community Hero
12 years ago

Alias objects identifying through code?

Not sure if this is possible ...



Can I take a name mapped object by it's Alias and then (using code) retrieve all the alias child objects that sit below it in the name map/alias file?



I'd like to use this effectively use the name map file to verify pages and key object on them in a web application although I'd like to apply the same principle to non-web stuff as well. The user would then simply say what page they want the object verified for and the code would find that page alias and check that all the child objects on it exist etc etc.



Can it be done?

4 Replies

  • Thanks for the response Simon. I'd had a look at checkpoints, and they didn't really seem to do what I was after.



    I've had another look, and I still don't think they do what I need.



    As I mentioned, I want this functionality to work on non-web based applications as well as web based. So that cuts out most of the checkpoint stuff.



    It pretty much only leaves Object and Property checkpoints.



    Property one is not what I need here.



    Object is close, but not quite what I want. It doesn't use Aliases, or indeed the name map file, as far as I can tell. And although you can set it to include/exclude child objects, it's pretty klunky about how it does it. If I uncheck a parent item, it doesn't uncheck all the child items below it?!?!? On a few pages there are a LOT of child items which I wouldn't want to include but I'd have to go though and uncheck them all one by one?



    And then if the page changes, I need to update the name map file AND the object checkpoints?



    Nope. Too much duplication of effort for something that isn't really doing what I want in the first place.



    The idea is, the important parts of application are stored in the name map file. Without going into too much detail about the application, I would want the user to be able to specify (we use a data driven framework) to check the content of a specific tab within a page. They would only specify the tab at the top level. The script would then identify the tab in the Aliases part of the name map file and t6hen cycle through the child Alias objects verifying them mainly by exists methods. The work would be done in selecting the right properties to store in the name map file in the first place.
  • I think I may have found a way of doing what I want using namemapping.sys and then working my way down the tree.



    It seems that when you use this to return mapped name, if they have an Alias set up, it returns the Alias name. So I can use that to tell the difference between object that are only in the name map, and those that have an Alias set up.



    Will experiment with it a little more and see how it goes.
  • OK. I'm sort of getting what I want using NameMapping.sys and NamedChild.



    Next question:



    If an object is not found, is there any way I can get more detail on what the object is besides it's index number as NamedChild? When the script is searching for the object, it pops up in the runtime dialog box saying



    "Waiting for <object name>"



    ... until the object is not found.



    I want to report out that these objects are missing. To someone viewing my test output, an object name would be far more useful than an index number. Is there any way I can get hold of this name whithin the script? It's obviously available as TestComplete uses it in the dialog while it looks for it. But it's not available as a property of the not found NamedChild.



    As an addition to this, NameMapping.sys seems to allow you to interrogate the name map file during a run. I can't find any similar functionality for the Alias structure? Is there any way this could be added as an enhancement? I would find it incredibly useful to be able to use and interrogate the Alias structure during a run rather than just using it to shorten object names within script.



    The full name map file contains parts of the application that the end user carrying out the testing (I provide a framework and modules for them to build tests from) is not likely to be interested in. I only really want it to report back on the controls they are interested in. If a control changes due to something changing further up the heirarchy and the check for it fails, I'm fine with that. It will flag up that I need to update the object map regardless. But I only want the reporting to the user to state things at certain levels. Anything beyond that will be investigated by me or the developers. Using the Alias file for this would be perfect!