Understanding Absolute and Relative Paths In QTP

Understanding Absolute and Relative Paths

You can save QuickTest resources, such as shared object repositories, function libraries, recovery scenarios or environments, using absolute or relative paths.

Note: If you are working with the Resources and Dependencies model with Quality Center 10.00, specify an absolute Quality Center path. For more information, see Considerations for Working with Relative Paths in Quality Center.
  • An absolute path describes the full path to a specific file starting from a fixed location such as the root directory, or the drive on which the file is located, and contains all the other sub-directories in the path. An absolute path always points to the specified file, regardless of the current directory.
  • A relative path describes the path to a specific file starting from a given directory, and is generally only a portion of the absolute path. A relative path therefore specifies the location of the file relative to the given location in the file system.

Using relative paths means that the paths remain valid when files or folders containing files are moved or copied to other locations or computers, provided that they are moved within the same folder structure. For this reason, we recommend that you use relative paths when saving resources in QuickTest.

For example, consider a QuickTest resource file named FunctionLibrary1.qfl located in C:\Current_Version\Libraries. The absolute path to the file is C:\Current_Version\Libraries\FunctionLibrary1.qfl. The relative path to the file from within the folder named Libraries is specified using only the name of the file, FunctionLibrary1.qfl. Alternatively, the relative path to the file from within another folder, such as C:\Current_Version\Libraries\MyFiles, would be Libraries\FunctionLibrary1.qfl.

Using a relative path, you could copy the FunctionLibrary1.qfl file from C:\Current_Version\Libraries to an updated version in C:\New_Version\Libraries, and the path used by QuickTest would remain valid.

In addition, relative paths are quicker to type and, being shorter, minimize any chance for error.

For more information, see Using Relative Paths in QuickTest.

Note: Prior to QuickTest 9.0, if you specified a path for a resource starting with \.., it was considered to be a relative path. In QuickTest 9.0 and later, a path that starts with \.. is considered to be a full path, with the backslash representing the root folder of the current drive.

If you defined paths starting with \.. using earlier versions of QuickTest, you should change the path to be a standard relative path by removing the backslash (\).


Post a Comment