Options Property

Applies to TestComplete 14.72, last modified on April 22, 2021

Description

The Options property specifies the command-line options to be passed to the Java Virtual Machine launcher. This is the same value as the one specified in the Environment options parameter for the tested Java application in the TestedApps editor.

Declaration

JavaTestedAppObj.Options

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 command-line options. For detailed information on the options, see the documentation for the Java Virtual Machine command line.

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 = true;
  app.JVMExecutable = "C:\\Program Files\\Java\\jre7\\Bin\\java.exe";
  app.JarFileName = "C:\\JavaApps\\SampleApp.jar";
  app.WorkFolder = "C:\\JavaApps";
  app.ApplicationArguments = "in data.txt";
  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 = True;
  app.JVMExecutable = "C:\\Program Files\\Java\\jre7\\Bin\\java.exe";
  app.JarFileName = "C:\\JavaApps\\SampleApp.jar";
  app.WorkFolder = "C:\\JavaApps";
  app.ApplicationArguments = "in data.txt";
  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 = true
  app.JVMExecutable = "C:\Program Files\Java\jre7\Bin\java.exe"
  app.JarFileName = "C:\JavaApps\SampleApp.jar"
  app.WorkFolder = "C:\JavaApps"
  app.ApplicationArguments = "in data.txt"
  app.Options = "-verbose:class"

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

  app.Close
End Sub

DelphiScript

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

  // Specify Java application's launch parameters
  app.RunAsJar := true;
  app.JVMExecutable := 'C:\Program Files\Java\jre7\Bin\java.exe';
  app.JarFileName := 'C:\JavaApps\SampleApp.jar';
  app.WorkFolder := 'C:\JavaApps';
  app.ApplicationArguments := 'in data.txt';
  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"] = true;
  app["JVMExecutable"] = "C:\\Program Files\\Java\\jre7\\Bin\\java.exe";
  app["JarFileName"] = "C:\\JavaApps\\SampleApp.jar";
  app["WorkFolder"] = "C:\\JavaApps";
  app["ApplicationArguments"] = "in data.txt";
  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

Highlight search results