kakabubu
6 years agoContributor
onTimeout breaks onLogError activities
I have onTimeout and onLogError even handlers overwritten
Spoiler
here is my implementation of the event handlers
const isTest = () => !!Project.TestItems.Current;
function GeneralEvents_OnLogError(Sender, LogParams) { if (!isTest() || testIsStoping || LogParams.Priority === pmLowest) return true; testIsStoping = true; Log.Error(LogParams.MessageText, LogParams.AdditionalText, pmLowest); logs.indentLog('Stop test on Error and reset test environment.'); afterFailedTest(); logs.outdentLog(); logs.post(ProjectSuite.Variables.config.postLogsOnError); LogParams.Locked = true; return Runner.Stop(true); } function GeneralEvents_OnTimeout(Sender, LogParams) { return testIsStoping ? true : GeneralEvents_OnLogError(...arguments); }
function afterFailedTest() {
//...
//some actions with application are perfomed here
//...
}
Sometimes the timeout expires while onLogError event handler did not finish. In that case, the following tests are broken because onTimeout event terminates tested application while some important actions are running.
From the articles I've found, (Timeout Property OnTimeout Event Stopping Tests on Timeout) I've picked the following info:
- The app is terminated before the event handler called
- Project.TestItems.Current.TimeOut is readOnly
Please help me to understand what is the right way to handle this case.
cunderw, i believe you could have similar problems.