=============== Have you ever wondered about how to effortlessly transfer your QTP scripts from your computer to one of colleagues or may be from a drive of your computer to another? Well, relative path is the answer.
There can be two types of path in your file System
1. full path or absolute path
2. Relative Path
A full path or absolute path is a path that points to the same location on one file system regardless of the working directory.
Example of a full path:
C:\Program Files\Mercury Interactive\QuickTest Professional\Tests
While A relative path is a path relative to the current working directory, so the full absolute path may not need to be given.
Example of a relative path: Say your current working directory is QuickTest Professional as shown above so the relative path for the folder Mercury Interactive which is one level up would be..\..\Mercury Interactive similarly folder which is on same level can be referenced by ..\Some Folder
Now that the definition is clear, I think you can guess the benefits of using relative paths in QTP. Suppose you have a test where you need to call a reusable action which was created in a different test. The normal steps we follow would be:
• Insert > Call to existing Action
• And then we select the reusable action from the drop down list.
The major drawback with this approach is that if you need to shift your files to some other computer where the similar path is not maintained you will have to do a lot of rework and map the reusable actions all again.
To get over this problem, we can use relative path. In the Select Action box as shown below instead of selecting the test just type in “..\Test1” If there is a test named “Test1″ in the current directory, action drop down box would automatically populate the list of reusable actions under it.
References: Wiki: Path
There can be two types of path in your file System
1. full path or absolute path
2. Relative Path
A full path or absolute path is a path that points to the same location on one file system regardless of the working directory.
Example of a full path:
C:\Program Files\Mercury Interactive\QuickTest Professional\Tests
While A relative path is a path relative to the current working directory, so the full absolute path may not need to be given.
Example of a relative path: Say your current working directory is QuickTest Professional as shown above so the relative path for the folder Mercury Interactive which is one level up would be..\..\Mercury Interactive similarly folder which is on same level can be referenced by ..\Some Folder
Now that the definition is clear, I think you can guess the benefits of using relative paths in QTP. Suppose you have a test where you need to call a reusable action which was created in a different test. The normal steps we follow would be:
• Insert > Call to existing Action
• And then we select the reusable action from the drop down list.
The major drawback with this approach is that if you need to shift your files to some other computer where the similar path is not maintained you will have to do a lot of rework and map the reusable actions all again.
To get over this problem, we can use relative path. In the Select Action box as shown below instead of selecting the test just type in “..\Test1” If there is a test named “Test1″ in the current directory, action drop down box would automatically populate the list of reusable actions under it.
References: Wiki: Path
Comments