On Error Call
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2014
07:27 PM
07-22-2014
07:27 PM
On Error Call
Hi,
I am using VBS to script my scenarios. TC works on remote machine and reports me in realtime with emails cases when results are different from expected. I run about 300 cases daily and want to concentrate on important cases only.
I have problems with cases when TC fails to get throgh the whole scenario - test fails with an error (overlapping windows, no object found or tested application fails with a fatal error). Of course there is info is the tests' log, but I created mail reports to avoid reading throgh 300 cases logs. Which cannot be reached while tests are going on anyway (12 hours or so, 5 am - 5pm).
Is there a way in TestComplete to force calling an 'error procedure' when there is error logged instead stopping / continuing the test?
regards
Greg
I am using VBS to script my scenarios. TC works on remote machine and reports me in realtime with emails cases when results are different from expected. I run about 300 cases daily and want to concentrate on important cases only.
I have problems with cases when TC fails to get throgh the whole scenario - test fails with an error (overlapping windows, no object found or tested application fails with a fatal error). Of course there is info is the tests' log, but I created mail reports to avoid reading throgh 300 cases logs. Which cannot be reached while tests are going on anyway (12 hours or so, 5 am - 5pm).
Is there a way in TestComplete to force calling an 'error procedure' when there is error logged instead stopping / continuing the test?
regards
Greg
1 REPLY 1
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2014
04:14 AM
07-24-2014
04:14 AM
VBS does not suport ErrorHandlers, and only options available are on Error ResumeNext and On Error Goto 0. However there is a solution - EventHandlers which I ignored so far:
http://support.smartbear.com/viewarticle/55502/
I added EventHandler 'OnLogError':
http://support.smartbear.com/viewarticle/55502/
I added EventHandler 'OnLogError':
'USEUNIT CommonScripts
'CommonScripts unit contains Subs and Functions used by other units, including MailErr and KillThemAll Sub
Sub
GameOver_OnLogError(Sender, LogParams)
'Take a screen shot of the active window.
Set Wshshell=CreateObject("Word.Basic")
WshShell.sendkeys"%{prtsc}"
'Send Keys seems to fail without a Proper Delay
Delay(500)
'Create PictureObject from Clipboard
Set PicObj = Sys.Clipboard
Call PicObj.SaveToFile("C:\ErrorPics\LastError.png")
'Send Email about error with prontscreen attached
Call MailErr(LogParams.AdditionalText, "GAME OVER - " & LogParams.MessageText)
'Kill all trash processes that might remain after error was logged
Call KillThemAll
'Stop
Runner.Stop(True)
End Sub
