Ask a Question

Object mapping for multiple environments

SOLVED
JamesP
Occasional Contributor

Object mapping for multiple environments

Hello, 

I am new to TestComplete v14.5 and am preparing some keyword tests to be used across all of our test environments.

I have found that the name mapping uses the full URL by default to id the object.

This means that each URL needs to be manually modified to replace the "www.website.com/" with * to enable it to work on different servers. 

 

Is there a way of avoiding this manual step and having the objects recorded only referring to the data to the right of the / (e.g. /extranet/do/rlLogin)?

 

Thanks for your help,

James

 

6 REPLIES 6
JamesP
Occasional Contributor

Thanks @Marsha_R,

 

I found using the search and replace feature to replace the variable website part of the URL with a wildcard can be done quickly across all the occurrences. But I still haven't found a way of having it not recorded in the first place. I'll keep the pots updated it I do!

 

Cheers,

James

AlexKaras
Champion Level 2

Hi James,

 

If you prepare a proper NameMapping (and Aliases) for tested web page before recording, then recorder should make recording in terms Aliases.Page.<...> syntax, not in the Sys.Browser(URL).<...> one.

 

Regards,
  /Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
JamesP
Occasional Contributor

Hi Alex,

 

Thanks for highlighting that.

I can see that there is a mix of Aliases. and NameMapping.Sys.browser. in my keyword tests.

How do I prepare a proper Name Mapping to ensure that it defaults to the Aliases ?

AlexKaras
Champion Level 2

Hi,

 

proper Name Mapping to ensure that it defaults to the Aliases

Well, there is some architecture that is good to be aware of:

-- Tested application contains some object that you'd like to interact with in test code. This (let's call it physical) tested object contains some properties with their corresponding values. Also this object is located at some level within the objects' hierarchy that exists in the tested application. This is the lowest layer;

-- Next NameMapping goes. NameMapping may be considered as a table that specifies the rule(s) that let test code to find the tested physical object. The proper set of rules (unique and stable identifiers, depth of search, conditional search, whether or not try to search down the objects' hierarchy) makes it possible for test code to find the tested object when the internal structure of the tested application changes (to some extent) during development or when the values of the properties that are used for object's identification change (for example, when testing on different environments). However the NameMapping itself is not perfect: it depends on the physical objects' hierarchy and might be changed when this hierarchy changes during development (for example, if tested objects are moved from one parent to another or some parents are added or removed). NameMapping is at the middle layer;

-- Aliases are at the highest level and their purpose it to make your test code to be as independent from the tested objects' hierarchy changes as possible. Aliases are located on top of NameMapping and are linked to it. You can adjust the structure of the Aliases tree very significantly but every element of Aliases tree remains to be linked to its corresponding NameMapping element. Which, in its turn is 'linked' to the physical tested object. So you may consider NameMapping as a translation table between Aliases (that correspond to the tested objects' hierarchy that is convenient to you as a user) and physical tested objects in the application. Note, that, for example, if because of changes in the objects' hierarchy in the tested application NameMapping must be changed (some NameMapping elements must be moved up or down the hierarchy or some new elements must be inserted in-between or removed), those changes will not alter Aliases tree and thus your test code will remain unchanged. Actually, there is no need to use NameMapping object in test code and Aliases one should be preferred one.

 

With the above in mind, the best strategy with automation with TestComplete is to investigate your tested application before test recording and create NameMapping and Aliases elements that identify the elements you will interact with during recording. In this case TestComplete will use Aliases elements during recording. Also with manual preliminary Aliases design you will get more clean and clear objects tree that better corresponds to the tested objects' hierarchy from the end-user point of view (more flat structure, absence of not necessary intermediate panels, more descriptive names, etc.)

 

Regards,
  /Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
JamesP
Occasional Contributor

Alex,

thanks for having taken the time to send me a clear description of how the Name Mapping/Alias structure works on top of the "physical" layer. The pre-mapping strategy is a good one and I will use it as I design my next tests.

 

Kind regards,

James

cancel
Showing results for 
Search instead for 
Did you mean: