OnLogError Eventhandler always fires before OnTimeout
I have two Eventhandler, one for timeout and the other one for Errors. For some reason I can't get into the Timeout Eventhandler as the OnLogError always fires in case of timeout and for some reason in that case no Error is set and the Script appears passed(green).
This are the two Event handler procedures in delphiscript:
1. OnLogError:
procedure umgebungSetzenbeiFehler (Sender;LogParams);
begin
Log.Message('Eventhandler Stop: Testfall wegen Fehler abgebrochen');
Runner.Stop(true);
end;
2. OnTimeout:
procedure GeneralEvents_OnTimeout(Sender; Params);
begin
Log. message('Der Test ist wegen Timeout abgebrochen');
Runner.Stop(true);
end;
If I remove the Runner.Stop(true) from the OnLogError Eventhandler I get into the Timeout. The problem is that I need the Runner.Stop(true) to stop the test item in case of an error.
Is there any solution for this? I think in case of a timeout the OnLogError event shouldn't fire.
As soon as the logic of TestComplete goes to write an error to the log, OnLogError fires. Since a Timeout is an error, the error event handler fires first as that is what happens first.
If you prefer the timeout to fire your Runner.Stop, what I would do is add code to your OnLogError event handler to check the contents of the error text being written. If it contains the text associated with a timeout, skip the handler code.