Occurs when a test run is over.
Occurs when TestComplete stops running a test, namely --
- When execution of any test in your project, for example, a script routine or a keyword test, is stopped.
- When execution of any project test item is stopped (regardless of whether you run individual test items or the entire project). If tests are organized into batches, the event will be fired for each test item.
You can create an
OnStopTest event handler to perform actions after the test execution is finished. For instance, the event handler can play sounds to indicate that the test execution has finished.
The event has the following parameter:
The Event control that processes the event.
It is not recommended to use global variables in the
OnStopTestevent handler. Typically, the scripting engine raises the
OnStopTestevent when these variables already have been cleared and are not available to your scripts. To avoid possible issues, we recommend that you use project variables rather than global script variables in
Note for JScript, C++Script and C#Script users: Since the test script finishes by the moment the
OnStopTestevent handler starts, the objects created by the script become invalid. If you store a reference to an object in a global script variable or in a project variable, it will refer to an invalid object and your script will cause the Can't execute code from a freed script error, even if the object is not null.
To work around the issue, create the object anew within your handler routine. If the object contains data that you need to use, you need to save this data to project variables, file or some external COM object.
OnStopTestevent is not generated if the test is stopped right after it has begun. Also, the
OnStopTestis not generated in Connected Applications.
In all other cases, the
OnStopTestevent is generated when the test run is finished. For instance, if --
In addition, do not call the
NetworkSuite.Synchronizemethod from the event handler. The method will always return False.