Micro Focus QTP (UFT) Forums
QTP Batch test exception handling - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: QTP Batch test exception handling (/Thread-QTP-Batch-test-exception-handling)



QTP Batch test exception handling - thotamurali - 10-20-2010

I am running a batch of QTP (test automation tool) scripts overnight. Could some one send me an error handling vb script code snippet that I may insert in each script which automatically exists any script that encounters an environmental or any other run time error in it's run but it should complete the run and logs the errors in the test results.


Thanks in Advance


RE: QTP Batch test exception handling - KVK - 10-20-2010

Hi,

You can use "On error resume next" at the begining of each script and at the end of the script check the error number and log the result.Below is the sample code

On error Resume Next

--lines of code
--
--

Code:
If err.Number <> 0 Then
SystemUtil.Closeprocessbyname "Iexplorer.exe"
Reporter.reportevent micfail ,"",""
ExitTest
End If

This can be done using a recovery scenario also..

Let me know if you have any questions on this..

- Vinod