cancel
Showing results for 
Search instead for 
Did you mean: 

NameMapping file sharing - one possible approach

Highlighted
Community Hero

NameMapping file sharing - one possible approach

Well, as all of you know, it is not possible to share the same NameMapping file between different TestComplete projects. This is not convenient if one has several test projects that automate the same tested application. In this case it is logical to have single shared NameMapping file to avoid repeated merging or duplicating object name maps for different projects.

Below I am sugesting one approach (or treat it as a workaround if you like) that works fine for me for several months already. I did not test it yet in the concurrent environment when the same test project is used over the network by several TestComplete instances running on different machines, but I do not expect that I will hit some problems.



So, assume that there are two TestComplete projects, Project1 and Project2 and we have a NameMapping file in, say, Project1 that we want to share with Project2.

To do this:

a) Create somewhere the folder for the shared project items and a subfolder for the NameMapping file. For example, let we have this folders structure:

|ProjectSuite

|  |

|  |_Common

|  |   | NameMapping

|  |

|  |Project1

|  |   | NameMapping

|  |   | Script

|  |

|  |Project2

|  |   | Script



b) Open ProjectSuite in TestComplete;

c) Add a new NameMapping item to Project2. This will create NameMapping subfolder with (empty) NameMapping.tcNM file in it. (Skip this step if Project2 already contains a copy of NameMapping file from Project1);

d) Save and close ProjectSuite in TestComplete;

e) Move NameMapping.tcNM file from the Project1\NameMapping\ folder into the _Common\NameMapping\ one and delete the Project1\NameMapping\ folder;

f) Delete the Project2\NameMapping\ folder with NameMapping.tcNM file;

g) Download the junction.exe utility (http://technet.microsoft.com/en-us/sysinternals/bb896768) from SysInternals.com site (you will be redirected to http://technet.microsoft.com/en-US/sysinternals as SysInternals guys are working for MS now);

h) Execute the following command from the command prompt:

"junction.exe" "<ProjectSuite>\Project1\NameMapping" "<ProjectSuite>\_Common\NameMapping"

This will create a junction point (hard link) named <ProjectSuite>\Project1\NameMapping for the physical <ProjectSuite>\_Common\NameMapping folder;

i) Execute the following command from the command prompt:

"junction.exe" "<ProjectSuite>\Project2\NameMapping" "<ProjectSuite>\_Common\NameMapping"

This will create a junction point (hard link) named <ProjectSuite>\Project2\NameMapping for the same physical <ProjectSuite>\_Common\NameMapping folder;

j) Navigate to <ProjectSuite>\Project1\NameMapping\ and <ProjectSuite>\Project2\NameMapping\ folders using any file manager and check that folders exist and there is NameMapping.tcNM file inside each of them;

k) Open ProjectSuite in TestComplete. Project suite should be opened without any problem and you should see identical NameMapping files in both Project1 and Project2 projects. Try to change NameMapping file in one project and check that the content of the file is updated in another project after you saved modified file;

l) Use test project as usual an enjoy. 🙂



Warnings:

-- Please note, that <ProjectSuite>\Project1\NameMapping\ and <ProjectSuite>\Project2\NameMapping\ folders with NameMapping.tcNM files inside them are not real folders and files, but hard links to the original _Common\NameMapping folder with all its contents. When you change NameMapping file in either Project1 or Project2 the changes are saved to the _Common\NameMapping\NameMapping.tcNM file;

-- If you occasionally delete NameMapping file from, say, Project1, this will delete _Common\NameMapping\NameMapping.tcNM file and, subsequently, will delete NameMapping from Project2, so be careful;

-- As \Project1\NameMapping\ and \Project2\NameMapping\ folders are just hard links, they must not be stored in the version control system. Only _Common\NameMapping\NameMapping.tcNM file must be stored there. If you need to put your test suite on a new test box, just extract the project contents from the version control system and perform steps h) and i) from above to create junction points.



Hope that the above will ease your testing life 😉
Regards,
  /Alex [Community Hero]
____
[Community Heroes] 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 Heroes]
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 Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
1 REPLY 1
Highlighted
Community Manager

RE: NameMapping file sharing - one possible approach


It's a very tricky approach, Alexei 🙂 


Thanks for sharing it with us!


 


For the community I want to repeat one more time - don't forget that you are setting up junction points in your project! It's even better to write it somewhere, even in the project name. Otherwise, the consequences may be fatal.


 

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors