Forum Discussion

v1kSandi3go's avatar
v1kSandi3go
Occasional Contributor
8 years ago

Is there anyway to get rid of NameMapping?

Hi All,

 

Is there any way to get rid of NameMapping? Since we've been doing a desktop App testing dealing with objects linked to the Namemapping recently we use the NameChild, this is will work? or we need to use tne VCL object?

 

Please share your thoughts, if we didn't get the namemapping we have an error object not found or missing object.

 

thanks in advance.

3 Replies

  • NisHera's avatar
    NisHera
    Valued Contributor

    Hi,

    Name mapping is used to simplify complex object structure of your application.

    If you consider typical application most objects names and properties are not used to create test. (They need to have in application, but we testers not using) Also using name mapping we can make more comprehensive short names for testing purpose.  

     

    For eg: with name mapping some object like…………………..

    “.Sys.Process("onelinkpromgn").Window("#32770", "ThinkPad OneLink Dock", 1).Window("Button", "Network and Sharing", 4)”

    Could be mapped to shorter name like “NameMapping. Onelink.SharingBtn”

     

    So if in your script you have used that short name, then without namemapping it cannot find what object you are referring to.

     

    But there are people out there who don’t use namemapping.  Either using exact names or using code to find necessary objects and properties.

     

    In your case if you have used namemapping yes then you need it. To get rid you have to carefully remove all dependencies for name mapping in your script.

    By the way why do want to get rid of?

    What do you mean by NameChild?

    What is tne VCL object?  

     

    Most ppl in this forum agrees

    1) Do name mapping manually (if auto mapping used it will get complex )

    2) Carefully select what objects should be mapped (eg only commonly used objects)

    3) Keep mapping as simple as possible ( eg;- Map only objects high in hierarchy so you may use find(s) to get children )

     

    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      If you decide to go through the process of removing NameMapping from your project, as NisHera mentioned, this is not simply a matter of removing the component from your project explorer.

       

      You mention you are referecing "NamedChild"... I'm guessing you're using either WaitNamedChild or WaitAliasChild?  If so, then those are dependant upon the objects actually being part of NameMapping... they will not work without NameMapping.  These are the places where you will need to replace the reference to your object with something more native... you mention VCL... 

       

      So, where you might have it mapped as

       

      Aliases.MyApp.MyForm.MyButton

       

      To use it without NameMapping, you MIGHT need to go like

       

      Sys.Process('myapp').VCLObject('myForm').VCLObject('myGroupPanel').VCLObject('myButtonGroup').VCLObject('OKButton')

       

      Notice a couple of things:

      1) The NameMapping has the advantage of being able to shorten and ignore intermediary items in the component tree.  So, a short Alias string MIGHT need to be replaced with something much longer

      2) Notice the button names... it is possible that these two things could represent the EXACT same component... but NameMapping allows you to assign your own naming convention to items without having to be limited to what is in the code.

      Basically... if you remove NameMapping, you're looking at a total re-write of your test project.  

      I guess the next question is... Why do you want to remove NameMapping?

      • v1kSandi3go's avatar
        v1kSandi3go
        Occasional Contributor

        Hi All,

         

        thanks for all your valuable inputs.

         

        Kudos!