UnitTest Object

Applies to TestComplete 15.47, last modified on January 20, 2023

Description

The UnitTest object provides a scripting interface to a unit or Selenium test added to your TestComplete project. To obtain the object in your scripts, use the following code:

TestObj = SeleniumOrUnitTestingCollection_Name.Test_Name

The object contains only one method, Execute, that runs the test from scripts.

The UnitTest object is available only if your project contains the Selenium or Unit Testing project item.

Members

Example

The following example runs a unit test.

JavaScript, JScript

function Test()
{
  …
  // Start the unit test
  SeleniumOrUnitTesting.JUnit1.Execute();
  …
}

Python

def Test():
  # Start the unit test 
  SeleniumOrUnitTesting.JUnit1.Execute()

VBScript

Sub Test
  …
  ' Start the unit test
  SeleniumOrUnitTesting.JUnit1.Execute
  …
End Sub

DelphiScript

procedure Test();
begin
  …
  // Start the unit test
  SeleniumOrUnitTesting.JUnit1.Execute;
  …
end;

C++Script, C#Script

function Test()
{
  …
  // Start the unit test
  SeleniumOrUnitTesting["JUnit1"]["Execute"]();
  …
}

See Also

Integration With Unit Testing Frameworks
Integration With Selenium

Highlight search results