Forum Discussion

ratnesh_prakash's avatar
11 years ago

Can we associate or disassociate name mapping file to a project at run time?

Hi,



I have been working on QTP till now but need to switch to TestComplete due to few limitations.

Needed to understand if we can associate/disassociate a name mapping file to a project at run time( as we do with object repositories in QTP).

Kindly assist.

1 Reply

  • sbkeenan's avatar
    sbkeenan
    Frequent Contributor
    Hi Ratnesh



    In our work environment, we have different 'development' versions of an application and sometimes I have to test in one and sometimes in another.  The applications are essentially the same but have a different application names and access different underlying databases so generating a name mapping file for one application will really only work with that application.



    The workaround I used was to create different name mapping configurations (see 'Name Mapping Configurations' in the help file).  I can then call an initialisation script which determines which version of the application is running and selects the associated name mapping file, something along the following lines:





    if (NameMapping.Sys.WaitProcess("<your application name>", 1000).Exists)

    {

       NameMapping.CurrentConfiguration = "<associated name mapping configuration>";

    }

    ...

    NameMapping.Sys.<your application name>.RefreshMappingInfo();





    I hope this will be of some assistance.



    Regards

    Stephen.