Forum Discussion

socaltester's avatar
socaltester
Contributor
7 years ago

Can wildcards be used in an object path?

On my project they've got us using test complete to automate functional tests for web applications that are not even close to being "stable", so the paths (or some portion of the paths) tend to change for each release. This causes us to "re-learn" all the new paths to the objects which decrease our time to execute and report automated regression test results.

 

I vaguely recall Selenium Webdriver allowing wildcards in a DOM or XPATH. Can the same be done with an path identified by TestComplete in a Keyword Test? Will simply moving the target object up the namemapping tree, beyond where the next change in the path occurs, work? I'd rather be able to use the former rather than the later as the later can be time consuming.

 

My preliminary search in this community and in user guide material didn't reveal an answer for me.

 

EXAMPLE PATH A (Original Path):

Aliases.browser.pageABC.frameMapIndexHtmlLangEnUsWidgetFrames.form.panelABCProps.panelDefaultSpeedsRanges.textboxMaxSpeed

 

EXAMPLE PATH B (Changed Path) *notice: the minor change in alias path name

Aliases.browser.pageABC.frameMapIndexHtmlLangEnUsWidgetFrames.form.panelABCPropsTab.panelDefaultSpeedsRanges.textboxMaxSpeed


  • socaltester wrote:

     

    - I didn't create a new alias. I simply updated the alias with the new path. Shift+Ctrl+A

    - Perhaps I chose too simple of an example, because most of the time there are entirely new DIVs/Panels/etc that show up in a new release.

     

     


    What I was trying to communicate was that didn't need to update the Alias.  All you needed to do was edit the mapping properties that were already there and you could have preserved your existing Alias.  This could include adding new Panels into the mapping hierarchy.  The Alias can stay static while you manipulate the mapping.  That's what NameMapping does for you.  So long as you just edit the mapping, the Alias can be used, basically, forever.  The link that I posted takes you through all sorts of means of editing, etc., where you can update and modify the mapping including, but not limited to, activating "Extended Find" on a component to account for added DIV/Panels, using wildcards in mapping properties to handle variable data, etc.  

     

    Regularly, we have the same deal where a new panel is added, "breaking" the mapping.  What I do then is I go to the object browser, map the "new" panel, and then, in the "Mapped Objects" panel of name mapping, I drag my originally mapped object to be a child of the new parent.  My Alias doesn't change, but now my mapping is fixed and my tests can continue.

     


    socaltester wrote:

     

     

    - Yes, I'm aware of using wildcards in property values of objects, but what seems to break the tests are the many changes that occur between Sys.browser and the VisibleOnScreen UI object to be tested. Your last sentence, "All you would need to to...", is definitely worth looking into. My predecessor has always chosen to not use TC's "Update Name Mapping during test run" option provided by Engine Options. This seems like a reasonable decision when one should be cautious. What is your recommendation? 

     

    Thank you for taking the time to help this novice. As mentioned in my post, I do search SmartBear's site and the blog for information before posting a question to the community blog, but I may not communicate my post as clearly as I should. My apologies.


    I believe I've answered with my recommendation.  There's no need to update the Alias with a new path (which, essentially, is creating a new Alias).  The Alias can remain as it always has.  Just do a bit of work with the mapping.  I personally would not use "Update Name Mapping during test run".  While automatic mapping is good to get started, it really only works well for very static applications.  Something more dynamic and variable I prefer to do the work myself.

     

    As for helping the novice... my pleasure.  I used to be one, too.  And there were amazing guys here AlexKaras being one of them, who helped me out.  So... I'm paying it forward.  If you need more guidance, let me know.

     

    As to your OP in your subject... the answer to that is "no".  You can't reference an Alias like below (note the wildcard).  This is not how NameMapping/Aliases work.  The answer to your specific problem is to update the Mapped Objects part of NameMapping so that you don't need to change your Alias.

     

    Aliases.browser.pageABC.frameMapIndexHtmlLangEnUsWidgetFrames.form.panelABCProps*.panelDefaultSpeedsRanges.textboxMaxSpeed

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    The Alias path that you have shown is what is mapped in TestComplete.  It is the full alias of the object.  If the application changes, you don't have to create a whole new Alias as you did.  You can go back and edit the existing Alias and it's mapping properties to match the new structure of the application under test.

     

    In that editing, you can add wildcards and such into the property values used for the mapping.  This way, all you need to do is maintain the Aliasing/Mapping of your objects and your test code can stay the same.  Technically speaking, by doing this, you wouldn't need to change the Alias of your original pathing.  All you would need to do would be to edit the Alias for the panelABCProps object to update the mapping criteria and your tests wouldn't need to change.

     

    Please read https://support.smartbear.com/testcomplete/docs/testing-with/object-identification/name-mapping/managing/index.html.  This goes through a whole list of topics on how to maintain and manage your mapped components.  I would also recommend going back and reading some of the basics about what an Alias is, what a mapped object is, how the two relate, etc.

    • socaltester's avatar
      socaltester
      Contributor

      "The Alias path that you have shown is what is mapped in TestComplete.  It is the full alias of the object.  If the application changes, you don't have to create a whole new Alias as you did.  You can go back and edit the existing Alias and it's mapping properties to match the new structure of the application under test."

       

      - I didn't create a new alias. I simply updated the alias with the new path. Shift+Ctrl+A

      - Perhaps I chose too simple of an example, because most of the time there are entirely new DIVs/Panels/etc that show up in a new release.

       

      "In that editing, you can add wildcards and such into the property values used for the mapping.  This way, all you need to do is maintain the Aliasing/Mapping of your objects and your test code can stay the same.  Technically speaking, by doing this, you wouldn't need to change the Alias of your original pathing.  All you would need to do would be to edit the Alias for the panelABCProps object to update the mapping criteria and your tests wouldn't need to change."

       

      - Yes, I'm aware of using wildcards in property values of objects, but what seems to break the tests are the many changes that occur between Sys.browser and the VisibleOnScreen UI object to be tested. Your last sentence, "All you would need to to...", is definitely worth looking into. My predecessor has always chosen to not use TC's "Update Name Mapping during test run" option provided by Engine Options. This seems like a reasonable decision when one should be cautious. What is your recommendation? 

       

      Thank you for taking the time to help this novice. As mentioned in my post, I do search SmartBear's site and the blog for information before posting a question to the community blog, but I may not communicate my post as clearly as I should. My apologies.

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        socaltester wrote:

         

        - I didn't create a new alias. I simply updated the alias with the new path. Shift+Ctrl+A

        - Perhaps I chose too simple of an example, because most of the time there are entirely new DIVs/Panels/etc that show up in a new release.

         

         


        What I was trying to communicate was that didn't need to update the Alias.  All you needed to do was edit the mapping properties that were already there and you could have preserved your existing Alias.  This could include adding new Panels into the mapping hierarchy.  The Alias can stay static while you manipulate the mapping.  That's what NameMapping does for you.  So long as you just edit the mapping, the Alias can be used, basically, forever.  The link that I posted takes you through all sorts of means of editing, etc., where you can update and modify the mapping including, but not limited to, activating "Extended Find" on a component to account for added DIV/Panels, using wildcards in mapping properties to handle variable data, etc.  

         

        Regularly, we have the same deal where a new panel is added, "breaking" the mapping.  What I do then is I go to the object browser, map the "new" panel, and then, in the "Mapped Objects" panel of name mapping, I drag my originally mapped object to be a child of the new parent.  My Alias doesn't change, but now my mapping is fixed and my tests can continue.

         


        socaltester wrote:

         

         

        - Yes, I'm aware of using wildcards in property values of objects, but what seems to break the tests are the many changes that occur between Sys.browser and the VisibleOnScreen UI object to be tested. Your last sentence, "All you would need to to...", is definitely worth looking into. My predecessor has always chosen to not use TC's "Update Name Mapping during test run" option provided by Engine Options. This seems like a reasonable decision when one should be cautious. What is your recommendation? 

         

        Thank you for taking the time to help this novice. As mentioned in my post, I do search SmartBear's site and the blog for information before posting a question to the community blog, but I may not communicate my post as clearly as I should. My apologies.


        I believe I've answered with my recommendation.  There's no need to update the Alias with a new path (which, essentially, is creating a new Alias).  The Alias can remain as it always has.  Just do a bit of work with the mapping.  I personally would not use "Update Name Mapping during test run".  While automatic mapping is good to get started, it really only works well for very static applications.  Something more dynamic and variable I prefer to do the work myself.

         

        As for helping the novice... my pleasure.  I used to be one, too.  And there were amazing guys here AlexKaras being one of them, who helped me out.  So... I'm paying it forward.  If you need more guidance, let me know.

         

        As to your OP in your subject... the answer to that is "no".  You can't reference an Alias like below (note the wildcard).  This is not how NameMapping/Aliases work.  The answer to your specific problem is to update the Mapped Objects part of NameMapping so that you don't need to change your Alias.

         

        Aliases.browser.pageABC.frameMapIndexHtmlLangEnUsWidgetFrames.form.panelABCProps*.panelDefaultSpeedsRanges.textboxMaxSpeed