Clear Method

Applies to TestComplete 15.69, last modified on November 13, 2024

The object-driven testing (ODT) functionality is deprecated. Do not use it to create new tests. It will be removed from the product in one of the future releases. As an alternative, you can create custom classes in your scripts. For more information, see Alternatives to the ODT functionality.

Description

Use the Data.Clear method to delete all existing data groups from the group collection as well as all variables that belong to them.

Declaration

DataObj.Clear()

DataObj An expression, variable or parameter that specifies a reference to a Data object
Result None

Applies To

The method is applied to the following object:

Result Value

None.

Example

The code below creates two new classes and then clears data and class collections at the end of the test run.

JavaScript, JScript

function ClearClassesExample()
{
  // Declares new classes
  ODT.Classes.Declare("MyClass");
  ODT.Classes.Declare("NewClass");
  // ...
  
  // Deletes all data from the Data object
  ODT.Data.Clear();
  
  // Deletes all the classes from the project
  ODT.Classes.Clear();
}

VBScript

Sub ClearClassesExample()

  ' Declares new classes
  ODT.Classes.Declare("MyClass")
  ODT.Classes.Declare("NewClass")
  ' ...
  
  ' Deletes all data from the Data object
  ODT.Data.Clear()
  
  ' Deletes all the classes from the project
  ODT.Classes.Clear()

End Sub

DelphiScript

function ClearClassesExample;
begin

  // Declares new classes
  ODT.Classes.Declare('MyClass');
  ODT.Classes.Declare('NewClass');
  // ...
  
  // Deletes all data from the Data object
  ODT.Data.Clear();
  
  // Deletes all the classes from the project
  ODT.Classes.Clear();

end;

C++Script, C#Script

function ClearClassesExample()
{
  // Declares new classes
  ODT["Classes"]["Declare"]("MyClass");
  ODT["Classes"]["Declare"]("NewClass");
  // ...
  
  // Deletes all data from the Data object
  ODT["Data"]["Clear"]();
  
  // Deletes all the classes from the project
  ODT["Classes"]["Clear"]();
}

See Also

AddGroup Method
DeleteGroup Method

Highlight search results