Forum Discussion

william_roe's avatar
william_roe
Super Contributor
9 years ago

Ensure Objects Not Used in Test Before Removing

In our trial and error approach to learning TC we have found ourselves with excess baggage (unused mapped objects and Aliases) which we wish to clean up. At some point we disabled 'Map object names automatically' and have a mix of tests using Mapped and Aliased object. How do we safely remove objects not used in keyword and script tests?

 

In the screen capture below you can see there are multiple 'frameTCmwebtestAuthorizepurchase' nodes under the 'sectionPrimarycontent' node as well as others.

 

Multiple Frames.JPG

 

I've looked at the 'NameMapping.tcNM' file and see two root nodes (NameMapping and Aliases) which seems intuitive. Using Notepad++ we can search all files in a directory for a given value and see that all three are in use. Looking at each node reveals that althought the names of the frames are similar the idStr(s) are slightly different -- probably since they were created before we disabled 'Map object names automatically'. One of the frameTCmwebtestAuthorizepurchase is for the return and differs obviously from the other two in the idStr. However, the other two are similar enough I'm unsure which to remove. Keep in mind both 'frameTCmwebtestAuthorizepurchase' and 'frameTCmwebtestAuthorizepurchase3' are found when searching the 'KeywordTests' folder. There idStr differs as follows:

 

't_CMWebTest_authorizepurchase_authorizepurchase_content' 't_CMWebTest_AuthorizePurchase_AuthorizePurchase__content'

 

Both can be found from the Alias browser when performing a 'Find Mapped Object' 

 

How do I know that I know which to remove from the 'Aliases' and 'Mapped Objects' explorer such that tests won't be broken? Or should I just leave it alone as the tests are running sucessfully? Is there a clean tool (feature request) for this?

4 Replies

    • william_roe's avatar
      william_roe
      Super Contributor

      Marsha_R wrote:

      What we did was backup the name napping file and then just started deleting the ones we thought were extra.  Run the tests after that and if something is missing, you can always remap it.  If it seems like there are too many missing things to deal with, just put the old name mapping file back.

       

      Feature requests go in this forum:

      http://community.smartbear.com/t5/TestComplete-Feature-Requests/idb-p/TestXCompleteFeatureRequests


      I guess if there isn't another alternative. However, we have over 5,000 steps and will take too long given the benefit. 

       

      Thanks for the reply.

    • william_roe's avatar
      william_roe
      Super Contributor

      Marsha_R wrote:

      What we did was backup the name napping file and then just started deleting the ones we thought were extra.  Run the tests after that and if something is missing, you can always remap it.  If it seems like there are too many missing things to deal with, just put the old name mapping file back.

       

      Feature requests go in this forum:

      http://community.smartbear.com/t5/TestComplete-Feature-Requests/idb-p/TestXCompleteFeatureRequests


      Here is the feature request. Please Kudo this request if you would like to see this feature added.

      • leandroaraujoso's avatar
        leandroaraujoso
        Contributor

        Hello William,

         

        If the clean-up is very important and time consuming at this stage, I think you might consider to create a program that read your scripts as well as your Name Mapping XML file and check whether a the mapped components are not being used in your code and then delete it from the Name Mapping XML. I think this is a relatively simple task to do.

         

        P.S.: If you decide on implementing it, please, post the source code here ;)

         

        As a last suggestion, remember, ALWAYS backup :)

         

        Regards,

         

        Leandro de Araújo Souza