Current Property (Specific to Project Object)

Applies to TestComplete 15.45, last modified on December 01, 2022

Description

Use the TestItems.Current property to obtain the project’s test item which is currently running. Note that Current returns the running test item of the lowest possible level. Suppose you have the same test items hierarchy as the one displayed below, and test item named C is running. In this case, Current returns a reference to test item C, but not to test items B or A, though they are also running.

Test Items Tree

If test items are not running (for example, you started a script routine or a keyword test manually from the Code Editor or from the Keyword Test editor), Current returns an “empty” value (Nothing in VBScript, None in Python, null in JavaScript, JScript, C++Script and C#Script, nil in DelphiScript).

For more information about projects’ test items, see Execution Plan Editor.

Declaration

Project TestItemsObj.Current

Read-Only Property A TestItem object
Project TestItemsObj An expression, variable or parameter that specifies a reference to a Project TestItems object

Applies To

The property is applied to the following object:

Property Value

The TestItem object corresponding to the currently running project’s test item.

Example

The following code snippet obtains a project’s test item which is currently running and posts its name to the test log.

JavaScript, JScript

function Test()
{

  var TestItems;
  …
  TestItems = Project.TestItems;
  Log.Message("The " + TestItems.Current.Name + " test item is currently running.");
  …

}

Python

def Test():
  TestItems = ProjectSuite.TestItems
  Log.Message("The " + TestItems.Current.ProjectName + " test item is currently running.")

VBScript

Sub Test

  Dim TestItems
  …
  Set TestItems = Project.TestItems
  Call Log.Message("The " & TestItems.Current.Name & " test item is currently running.")
  …

End Sub

DelphiScript

procedure Test();
var TestItems;
begin
  …
  TestItems := Project.TestItems;
  Log.Message('The ' + TestItems.Current.Name + ' test item is currently running.');
  …

end;

C++Script, C#Script

function Test()
{

  var TestItems;
  …
  TestItems = Project["TestItems"];
  Log["Message"]("The " + TestItems["Current"]["Name"] + " test item is currently running.");
  …

}

See Also

Test Items Page
ItemCount Property (Specific to Project Object)
TestItem Property (Specific to Project Object)

Highlight search results