Forum Discussion

jthompson1's avatar
jthompson1
Contributor
8 years ago

Changing versions of software breaks name mapping

I found with one of our windows desktop applications that every time I updated the software to it's latest version, my regression tests were utterly useless because the name mapping was completely thrown off. Now I went ahead and revisited the Name Mapping section in support, and I think I have a method down that is fixing this issue. I have to manually go in and remove anything that has versioning in it for name mapping, and I am also manually naming everything, and selecting what properties it uses for mapping. It's very tedious and not the most ideal approach. I was wondering if anyone with a lot of knowledge and experience had a less painful way. Perhaps a method that still utilizes the auto name mapping that is created by test complete and does not get thrown off every time I update the version of our application. I guess the question is, does anyone have some best practices with name mapping? I was trying to wrap my mind around templates for name mapping and I am not sure if I am focusing my attention on the right solution at this point. Any feedback would be appreciated. 

9 Replies

  • cunderw's avatar
    cunderw
    Community Hero

    In my experience, I have found the best approach is to have a very minimal name mapping, and use Find methods in scripts to create a framework of global utilities that are shared among all projects that are testing a specific application.  

    • Colin_McCrae's avatar
      Colin_McCrae
      Community Hero

      I'm OK with helper functions such as those outlined by cunderw. I use them myself - alongside mapping. My caveat for those though is beware of the performance hit they can come with.

       

      If you start every search at a very high level of an application, and the application has a busy object model, things can get very slow as it has to search for every object it needs before it can use it.

       

      Not a "don't do it", more of a "beware".

       

      Also, depending how you set these up, if you have reference calls to them all over your scripts, and something gets updated, I can see the situation arising where you're left raking through huge piles of script units looking for calls to helper functions to update the search parameters you're sending them.

       

      Neither way is perfect. They both have their pro's and con's (hence why I use both). But both require a little forethought and planning to make them last well in the long term.

  • Bobik's avatar
    Bobik
    Frequent Contributor

    Could you show example of incorrect namemapping? What properties and values are wrong do you think?

    • Colin_McCrae's avatar
      Colin_McCrae
      Community Hero

      Anything mapped using a property that contains some sort of version number as an identifier has no chance.

       

      Reliable long term name maps, in my experience, require a bit of donkey work up front. Choose rock solid, reliable properties. If you can, make sure your dev team know that you're using these properties. A helpful dev team will give you properties which work well with automated tests.

       

      But I map everything manually and am very selective of the properties I use.

       

      Making good use of the Alias map can make maintaining the integration of mapped objects into scripts much, MUCH, easier as well.

       

      I have lost track of how many times I've said it on here but ......

       

      If you are using Aliases which are a straight copy of a mapped object, complete with big horrible long name as captured by the system ..... YOU'RE DOING IT WRONG!!!!

       

      The Alias objects should be shortened, human readable, and have a MUCH more direct mapping to how THE USER sees the application.

       

      Systems need lots of invisible layers to build themselves. Users don't know, or care, about most of these invisible layers. You Alias map should reflect that.

       

      eg.

       

      screenCFS1911.frame-x371bv4.panelz51a.container1.container2.buttonbar.containerb1z3922yy.button1xSV

       

      ... is NOT a good alias.

       

      CustomerPage.ButtonBar.Save

       

      ... IS a good alias.

       

      Which also has the advantage that if container layers change (as they often do) but the logical layout of a screen does not (at least, as far as the end user is concerned) then you fix the object map. Make sure the Alias is still tied to the fixed object, and you scripts don't need any updating.

       

      ie. Aim to only have to update the low level (object) map. Not the high level (alias) one. Obviously, it's impossible to guarantee you'll never have to update both. But a little careful planning and prep keeps it to a minimum.

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        One thing to consider in how you think about name mapping... in some automated frameworks, especially with things like Selenium and Maven and so forth, there's the concept of a "Page Object Model".  This is something you build very deliberately and very carefully so that your tests that you execute have a good reference model to be able to interact with the UI.

         

        NameMapping is just such a thing, but it is built into the TestComplete tool rather than something you need to build by hand in C# or Java. So, the same amount of care and deliberation that you would take in building a POM for a Selenium framework you should use with NameMapping.  The Automatic mapping is a good start, but just like doing record/playback test scripts, you don't want to just leave those as is... Use the automatic mapping to give you reference points of the objects that you are interacting with and then, as Colin_McCrae pointed out, spend time in picking good, solid, reliable properties for your more permanent maps. Use features like the "Extended Find" and "Required Children" to handle some of the variability... use wildcards where they are useful but not too much as this could cause your name mapping to get confused between two similar objects. AND.. as Colin_McCrae also mentioned, don't be afraid to ask your developers to add a few little properties to components to make them easier to find. I did this with a web application I was testing once (and they are NOTORIOUS for having constantly changing components and object trees) and it made a HUGE difference.  No matter how the application changed, those custom properties NEVER did and it made my NameMapping MUCH more reliable..

    • jthompson1's avatar
      jthompson1
      Contributor

      .

      Some of the parent windows would use the WndCaption property for mapping, and that property had the version number of the software. Now when I update the software, and run an automated keyword test it goes out and looks for that object with the WndCaption of Version XYZ. Since they no longer match the test fails stating the object does not exist. I was having to go in and remove that property, and since I was already putting my hands on it I was renaming everything so that it was more to clear to me what that object was. After performing this task on all my name mapping I was rerunning the tests with different version numbers, and thus far it's been executing the tests without any errors.

      • cunderw's avatar
        cunderw
        Community Hero

        Just an FYI, you can also use wildcards in your mapping criteria.

         

        Ex. if the caption was 'Application v2.0.0', you could specify 'Application v*'

         

        Sounds like you have it working now, but if you ever have trouble finding a good static property, this might be useful.

  • I was just going to post what cunderw did previously...

     

    The software I test has a dynamic NAME and WNDCAPTION that consists of:

     

    <program><USERID><Version><Version date><env> i.e. AL JLN Ver 97 @ 10/24/16 DEV

     

    I simply map it with the WNDCAPTION of AL* because I like my scripts to be environment independent.