anik_cadieux
11 years agoContributor
How to terminate correctly the test suite when getting OnTimeout event
If we want to send an email at the end of the execution of the suite, we do this in the OnStop event where a routine checks if we are in the last active test item of the last active project, then calls a "finalization routine". But when OnTimeout event occurs, how can we know if we are in the last test case item to be run ?
What is the recommendation ?
Here is our detailed situation:
- We are using TestComplete entirely with JScripts.
- We have a projet suite holding 2 projects, each project has several Test Items.
- Some Test Items have the option "Stop On Error" set to "Project" (App authentication for example), and all others have the option set to "None".
- Most test items have a timeout of 5 minutes, while the projects have a timeout of 30 minutes.
- We want the test to run the finalization routine only once, and only at the last test item to be run.
Here is our code:
function GeneralEvents_OnStopTest(Sender)
{
var lastTestCase;
var strFromName = "";
var strEmailContent = "";
lastTestCase = FindLastTestCaseItem(BoolLastOfTheSuite); //Finds the last active test case item of the last active Project
if (lastTestCase != null)
{
if (lastTestCase.Name == Project.TestItems.Current.Name)
{
FinalizeRun();
}
}
}
function GeneralEvents_OnTimeout(Sender, Params)
{
Runner.Stop(true);
}
Several problems:
- The problem with this is that when the test item reaches the timeout (either test items or project), no email is sent if it did not happen during the last active test item
Any ideas ?