ClearSettingsBeforeEachRun Property

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

Description

The IDLLAccessProcessOptions.ClearSettingsBeforeEachRun property specifies whether TestComplete clears the reference to DLL objects between test runs.

By default, the property value is set to True, that is, all the references to DLL objects created during the current test run are cleared after the test run is over.

If you want to change this behavior, set the property value to False. TestComplete will keep the references to DLL objects between test runs, for example, between script routine, keyword test and test item (regardless of whether you run separate test items or the entire project) runs. The references will be kept until you close TestComplete or until you restore the default behavior.

Declaration

IDLLAccessProcessOptionsObj.ClearSettingsBeforeEachRun

Read-Write Property Boolean
IDLLAccessProcessOptionsObj An expression, variable or parameter that specifies a reference to an IDLLAccessProcessOptions object

Applies To

The property is applied to the following object:

Property Value

A boolean value that specifies whether the references to DLL objects are cleared after the test run is over. True if the references are cleared. False otherwise.

Remarks

If the property is set to false, the DefineType and DefineProc methods post warning messages to the test log if they register data types and routines that were registered during a previous test run.

Note that keeping references to DLL objects between test runs may reduce the test robustness.

Example

The code below demonstrates how to change the value of the ClearSettingsBeforeEachRun property in the default environment for loading DLLs and then posts the new value of the setting to the test log:

JavaScript, JScript

function OptionsExample()
{

  // Gets the Options object
  var opts = DLL.Options;
  // Sets the new value to the ClearSettingsBeforeEachRun property
  opts.ClearSettingsBeforeEachRun = false;
  // Posts the new ClearSettingsBeforeEachRun value to the test log
  Log.Message(opts.ClearSettingsBeforeEachRun);
  …

}

Python

def OptionsExample():
  # Gets the Options object 
  opts = DLL.Options
  # Sets the new value to the ClearSettingsBeforeEachRun property 
  opts.ClearSettingsBeforeEachRun = False
  # Posts the new ClearSettingsBeforeEachRun value to the test log 
  Log.Message(opts.ClearSettingsBeforeEachRun)
  # ...

VBScript

Sub OptionsExample

  Dim options
  ' Gets the Options object
  Set opts = DLL.Options
  ' Sets the new value to the ClearSettingsBeforeEachRun property
  opts.ClearSettingsBeforeEachRun = false
  ' Posts the new ClearSettingsBeforeEachRun value to the test log
  Log.Message(opts.ClearSettingsBeforeEachRun)
  …

End Sub

DelphiScript

procedure OptionsExample;
var opts;
begin

  // Gets the Options object
  opts := DLL.Options;
  // Sets the new value to the ClearSettingsBeforeEachRun property
  opts.ClearSettingsBeforeEachRun := false;
  // Posts the new ClearSettingsBeforeEachRun value to the test log
  Log.Message(opts.ClearSettingsBeforeEachRun);
  …

end;

C++Script, C#Script

function OptionsExample()
{

  // Gets the Options object
  var opts = DLL["Options"];
  // Sets the new value to the ClearSettingsBeforeEachRun property
  opts["ClearSettingsBeforeEachRun"] = false;
  // Posts the new ClearSettingsBeforeEachRun value to the test log
  Log["Message"](opts.ClearSettingsBeforeEachRun);
  …

}

See Also

IDLLAccessProcessOptions Object
Calling DLL Functions From Tests

Highlight search results