ClassPaths Property

Applies to TestComplete 14.92, last modified on September 16, 2021

Description

The ClassPaths property specifies the path(s) to folders or .jar files to search for Java classes used in the application. If you are testing a Java application in the form of .class files or a .jar file that does not have a startup class defined, the ClassPaths property must specify the classes to be tested.

This is the same value as the one specified in the Class paths parameters in the TestedApps editor.

Declaration

JavaTestedAppObj.ClassPaths

Read-Write Property String
JavaTestedAppObj An expression, variable or parameter that specifies a reference to a JavaTestedApp object

Applies To

The property is applied to the following object:

Property Value

A string value containing the list of folder paths and .jar file paths. Paths in the list must be separated by the new line character.

Remarks

If you assign a value to this property, TestComplete will treat your project as modified. So, you will need to save or cancel changes when closing the project. The specified value will be displayed in the TestedApps editor.

To specify the property value, you can use project and project suite variables as well as the operating system’s environment variables.

The project or project suite variables must be of the string type. To refer to them, use the following syntax --

$(var_name)

--for example, “$(MyVar1)”.

Note: When evaluating the value of the property, TestComplete first searches for the specified variable in the project variables, then in the project suite variables. Please keep this in mind if you have project and project suite variables with the same names.

To refer to environment variables, use the following syntax --

%var_name%

-- for example, %Path%.

Note that variables can refer to each other, for instance, a project variable may include a reference to an environment variable. TestComplete will recursively analyze the variables and form the resulting value that does not contain variable names.

Example

The following example adds a new Java application to a project, specifies its launch parameters and then launches the application:

JavaScript, JScript

function Test()
{
  // Add a Java application to the project
  var ind = TestedApps.AddJavaApp();
  var app = TestedApps.Items(ind);

  // Specify Java application's launch parameters
  app.RunAsJar = false;
  app.JVMExecutable = "C:\\Program Files\\Java\\jre7\\Bin\\java.exe";
  app.EntryPoint = "com.automatedqa.testcomplete.OrdersApp";
  app.ClassPaths = "C:\\JavaApps\\SampleApp.jar" + "\r\n" + "C:\\JavaApps\\CustomClasses\\";
  app.Options = "-verbose:class";

  // Launches the Java application
  app.Run();
  // Test the application
  …

  app.Close();
}

Python

def Test():
  # Add a Java application to the project
  ind = TestedApps.AddJavaApp()
  app = TestedApps.Items[ind]
  # Specify Java application's launch parameters
  app.RunAsJar = False
  app.JVMExecutable = "C:\\Program Files\\Java\\jre7\\Bin\\java.exe"
  app.EntryPoint = "com.automatedqa.testcomplete.OrdersApp"
  app.ClassPaths = "C:\\JavaApps\\SampleApp.jar" + "\r\n" + "C:\\JavaApps\\CustomClasses\\"
  app.Options = "-verbose:class"
  # Launches the Java application
  app.Run();
  # Test the application
  # ...
  # app.Close()

VBScript

Sub Test
  ' Add a Java application to the project
  ind = TestedApps.AddJavaApp
  Set app = TestedApps.Items(ind)

  ' Specify Java application's launch parameters
  app.RunAsJar = false
  app.JVMExecutable = "C:\Program Files\Java\jre7\Bin\java.exe"
  app.EntryPoint = "com.automatedqa.testcomplete.OrdersApp"
  app.ClassPaths = "C:\JavaApps\SampleApp.jar" + vbCrLf + "C:\JavaApps\CustomClasses\"
  app.Options = "-verbose:class"

  ' Launches the Java application
  app.Run
  ' Test the application
  …

  app.Close
End Sub

DelphiScript

procedure Test();
var
  ind : integer;
  app : OleVariant;
begin
  // Add a Java application to the project
  ind := TestedApps.AddJavaApp();
  app := TestedApps.Items(ind);

  // Specify Java application's launch parameters
  app.RunAsJar := false;
  app.JVMExecutable := 'C:\Program Files\Java\jre7\Bin\java.exe';
  app.EntryPoint := 'com.automatedqa.testcomplete.OrdersApp';
  app.ClassPaths := 'C:\\JavaApps\\SampleApp.jar' + #10#13 + 'C:\JavaApps\CustomClasses\';
  app.Options := '-verbose:class';

  // Launches the Java application
  app.Run;
  // Test the application
  …

  app.Close;
end;

C++Script, C#Script

function Test()
{
  // Add a Java application to the project
  var ind = TestedApps["AddJavaApp"]();
  var app = TestedApps["Items"](ind);

  // Specify Java application's launch parameters
  app["RunAsJar"] = false;
  app["JVMExecutable"] = "C:\\Program Files\\Java\\jre7\\Bin\\java.exe";
  app["EntryPoint"] = "com.automatedqa.testcomplete.OrdersApp";
  app["ClassPaths"] = "C:\\JavaApps\\SampleApp.jar" + "\r\n" + "C:\\JavaApps\\CustomClasses\\";
  app["Options"] = "-verbose:class";

  // Launches the Java application
  app["Run"]();
  // Test the application
  …

  app["Close"]();
}

See Also

JavaTestedApp Object
Testing Java Applications
Java Application Parameters
EntryPoint Property

Highlight search results