Forum Discussion

seafalcon's avatar
seafalcon
Contributor
15 years ago

the relationship between name mapping map and testscript

After I recorded several testscript, I just have one NameMapping item in the project. that means all testscripts share one namemapping item in same project? is it possible for one project to contain multiptle nameMapping items? what should testers do if there are overlapped objects cross different  test scripts? or different objects have the same name during the recording?



May I add new name mapping definitions into exsiting name mapping items? I know I can delete them.. but not sure I can add or not .




Thanks 


3 Replies

  • Hi Philip,



    >> that means all testscripts share one namemapping item in same project?

    That is right.



    >> is it possible for one project to contain multiptle nameMapping items?

    No.



    >> what should testers do if there are overlapped objects cross different  test scripts?

    What do you mean by "overlapped objects"?



    >> different objects have the same name during the recording?

    You need to choose a set of properties for mapping that uniquely identifies each object.



    >> May I add new name mapping definitions into exsiting name mapping items?

    Yes. Double-click the item you need to edit and apply all necessary changes (see the Managing Mapped Objects help topic).
  • The overlapped objects means some objects are recreated in the runtime, or the newly created objects which have same reference(classname, wincaption, or index) with the previous ones.. but in different position.



    I think you misunderstood my last question. What I mean is can I create a new name mapping definition for objects?

    such as : I want to create a new mapping definition in name mapping item:




    lookupedit3=Alias[mainForm][gridControl]("lookupedit","3" );




    is it possible? and how to do it?




    Thanks


  • Hi Philip,





    >>>

    The overlapped objects means some objects are recreated in the runtime, or the newly created objects which have same reference(classname, wincaption, or index) with the previous ones.. but in different position. 

    <<<

    If an object is recreated, you need to refresh the mapping information by calling the RefreshMappingInfo method right after the recreation.





    If a new object is created, you need to modify the name mapping scheme in such a way that TC can uniquely identify the necessary object (don't forget to call RefreshMappingInfo before obtaining the new object).









    >> What I mean is can I create a new name mapping definition for objects?

    As far as I understand, you need to add items to the name mapping scheme from your script. You can do this by using the AddNamedChild method (see the Methods and Properties Added to Mapped Objects help topic).





    However, we do not recommend that you use this. More convenient approach is to use the FindChild method to find the necessary object by specific property values.