Forum Discussion

Wamboo's avatar
Wamboo
Community Hero
5 years ago
Solved

Project without NameMapping

Hey,   We write a project for an application written in Delphi which is a monolith. The application has been developed for over 20 years and its size is huge. In the project we are using NameMa...
  • AlexKaras's avatar
    5 years ago

    Hi,

     

    To add to what was said by Lino:

     

    > SVN, GIT working in a few people 

    Only script unit files can be merged with the reasonable risk level. Though even this is not recommended. All other project files must not be merged by any means. Thus one of the most important tasks for you will be to split test code between different script units and assign tasks to people in a way that minimizes concurrent changes. Merging is a price that is paid for distributed development and must be avoided as much as possible.

     

    > Why use NameMapping?

    Strictly speaking, you should use not NameMapping, but Aliases. NameMapping is just a translation table between the physical objects layout of your tested application and logical organization of same objects convenient for your test code.

     

    > Example:
    > a) without NameMapping
    > var Edit = Sys.Process("pulse").VCLObject("LogOnForm").VCLObject("GroupBox").VCLObject("UsernameEdit");
    > b) with NameMapping
    > var Edit = Aliases.impuls.wndLogOnForm.Panel.Edit;

     

    More correct example would be:

    For version A of tested application:

    a) without NameMapping
    var Edit = Sys.Process("pulse").VCLObject("LogOnForm").VCLObject("GroupBox").VCLObject("UsernameEdit");
    b) Your test code with Aliases:
    var Edit = Aliases.impuls.wndLogOnForm.UserName; // intermediate panel was excluded as it does not matter for test code

     

    Now for version B of tested application:

    a) without NameMapping
    var Edit = Sys.Process("pulse").VCLObject("LogOnForm").VCLObject("LoginUsingADGroupBox").VCLObject("GroupBox").VCLObject("LoginCredentials").DevExpressObject("UserLogin");
    b) with Aliases:
    var Edit = Aliases.impuls.wndLogOnForm.UserName; // <== Aliased name remained not changed because only NameMapping translation table had to be adjusted for the new objects structure.

     

    From the above example it should be obvious that with Aliases (and proper configurations of NameMapping)test code can remain the same for different versions of tested application.

     

    > If the NameMapping file grows to a large size, is it a performance problem?

    Yes it is. Thus not everything must be mapped. Best practice is to create a 'sceleton' map of your tested application and use created mapped objects as anchors for dynamic objects search via .FindXXX() methods.