Description
The Path
property returns the full path to the folder that contains the file of the current TestComplete project (.mds).
Declaration
Applies To
The property is applied to the following object:
Property Value
A string that represents the path to the folder that contains the current project in TestComplete. The string holds the trailing slash character (\
).
Remarks
When converting TestComplete 3 projects to the version 4 format, TestComplete automatically changes the Options.Project.Directory
statement to Project.Path
. Note that if your TestComplete 3 scripts used the Options.Project.Directory
property to specify a path to files relative to your project, the converted code will return invalid file paths. This happens because TestComplete changes the project files location and reorganizes folders during the conversion.
Example
The following example demonstrates how to obtain the path to the folder that stores the current project and export compressed results of the current test to that folder.
JavaScript, JScript
{
var Path;
// Obtains the path to the current project
Path = Project.Path;
Path = Path + "CompressedResults\\" + aqConvert.DateTimeToFormatStr(aqDateTime.Now(), "%m_%d_%Y_%H_%M_%S");
// Compresses the current test results
if (slPacker.PackCurrentTest(Path))
Log.Message("Test results have been compressed successfully");
…
}
Python
def ProjectSample():
# Obtains the path to the current project
Path = Project.Path
Path = Path + "CompressedResults\\" + aqConvert.DateTimeToFormatStr(aqDateTime.Now(), "%m_%d_%Y_%H_%M_%S")
# Compresses the current test results
if slPacker.PackCurrentTest(Path):
Log.Message("Test results have been compressed successfully")
VBScript
Dim Path
' Obtains the path to the current project
Path = Project.Path
Path = Path + "CompressedResults\" + aqConvert.DateTimeToFormatStr(aqDateTime.Now, "%m_%d_%Y_%H_%M_%S")
' Compresses the current test results
If slPacker.PackCurrentTest(Path) Then
Log.Message "Test results have been compressed successfully"
End If
…
End Sub
DelphiScript
var Path;
begin
// Obtains the path to the current project
Path := Project.Path;
Path := Path + 'CompressedResults\' + aqConvert.DateTimeToFormatStr(aqDateTime.Now, '%m_%d_%Y_%H_%M_%S');
// Compresses the current test results
if slPacker.PackCurrentTest(Path) then
Log.Message('Test results have been compressed successfully');
…
end;
C++Script, C#Script
{
var Path;
// Obtains the path to the current project
Path = Project["Path"];
Path = Path + "CompressedResults\\" + aqConvert["DateTimeToFormatStr"](aqDateTime["Now"](), "%m_%d_%Y_%H_%M_%S");
// Compresses the current test results
if (slPacker["PackCurrentTest"](Path))
Log["Message"]("Test results have been compressed successfully");
…
}
See Also
Project.FileName
Project.ConfigPath
ProjectSuite.Path
ProjectSuite.FileName