Forum Discussion

sdruker's avatar
sdruker
Contributor
11 years ago
Solved

NameMapping Architecture Design

Hi,

I am using testcomplete for web testing.

I want advice on how to design the hierarchy of the Namemapping tree.



First I wanted to know if it is possible to create multiple objects of type  "Browser"


I have a web application that consists of several parts 


Each part has a different address 


So I thought to make a division of the tree by components .

Each component (Parent) will be an object of type "PAGE" (or browser if it possbile to have multiple Browser objects) and underneath will be all the child objects of this compnent page.

 


I'd love to hear your opinion ,Whetere is it a good way or not 


Thanks



Silvana

  • Hi Silvana,



    > I have a web application that consists of several parts 

    > Each part has a different address 



    You may try the following approach (just did not try it for several web addresses but it works fine for me in case of one address and TC identifies correct browser if more than one is running at the same moment):

    a) Map first page of your application. This will create namemapping for the Browser and Page objects;

    b) In the NameMapping editor select the Browser object (rename it to something like BrowserPartA), switch to the Required Children tab (usually it is on the lower right from the Mapped Objects tree) and select a check--box for the Page object;

    c) Now navigate to the second part of your application and try to map the page again. I hope that this will create another mapping for the Browser and Page objects because the first Browser object will not match as it does not have corresponding required Page;

    d) Switch to NameMapping Editor and set a Page as a required child for the new Browser object as in step b) (and give a Browser object a name like BrowserPartB);

    e) Now you can map other objects for those two pages and I hope that TC will put them into correct NameMapping subtrees for BrowserPartA and BrowserPartB correspondingly.



    After you done with mapping, I would recommend to switch to the Aliases tab of the NameMapping editor, adjust created tree so that it is convenient for you to use (remove not necessary tree nodes to simplify mapped tree structure) and than use in your code not Namemapping object, but Aliases one. This will make your test code less dependent from possible UI design changes because, when the UI changes, you will need to correct namemapping and check that corrected namemapped name is referenced by the same aliased name. As long as you will be able to do this, your test code will require no corrections in the terms of objects' identification.

1 Reply

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3
    Hi Silvana,



    > I have a web application that consists of several parts 

    > Each part has a different address 



    You may try the following approach (just did not try it for several web addresses but it works fine for me in case of one address and TC identifies correct browser if more than one is running at the same moment):

    a) Map first page of your application. This will create namemapping for the Browser and Page objects;

    b) In the NameMapping editor select the Browser object (rename it to something like BrowserPartA), switch to the Required Children tab (usually it is on the lower right from the Mapped Objects tree) and select a check--box for the Page object;

    c) Now navigate to the second part of your application and try to map the page again. I hope that this will create another mapping for the Browser and Page objects because the first Browser object will not match as it does not have corresponding required Page;

    d) Switch to NameMapping Editor and set a Page as a required child for the new Browser object as in step b) (and give a Browser object a name like BrowserPartB);

    e) Now you can map other objects for those two pages and I hope that TC will put them into correct NameMapping subtrees for BrowserPartA and BrowserPartB correspondingly.



    After you done with mapping, I would recommend to switch to the Aliases tab of the NameMapping editor, adjust created tree so that it is convenient for you to use (remove not necessary tree nodes to simplify mapped tree structure) and than use in your code not Namemapping object, but Aliases one. This will make your test code less dependent from possible UI design changes because, when the UI changes, you will need to correct namemapping and check that corrected namemapped name is referenced by the same aliased name. As long as you will be able to do this, your test code will require no corrections in the terms of objects' identification.