Micro Focus QTP (UFT) Forums
How to close QTP session automatically if any runtime error occurs - 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 Others (https://www.learnqtp.com/forums/Forum-UFT-QTP-Others)
+--- Thread: How to close QTP session automatically if any runtime error occurs (/Thread-How-to-close-QTP-session-automatically-if-any-runtime-error-occurs)



How to close QTP session automatically if any runtime error occurs - Remesh Kumar R - 01-14-2011

Hi,

We are using QTP(Ver.9.5) for testing our Oracle 10g based product (Forms and Reports). I created many test cases and the cases are calling as a batch. Many batches are called in order through VB script (.vbs file).

My problem is if any test case is stopped with an Oracle error or a QTP runtime error, I have to log the error and QTP should continue with next batch automatically. Now, the Oracle error has been handled but when a QTP runtime error occurs, it stops there.

My requirement is if any QTP runtime error occurs, it should not stop there and should continue automatically by closing the error QTP session and its related opened Web based windows of Oracle.

Could you please advise me in this issue ?

[/align]Thanks in advance,
Remesh



RE: How to close QTP session automatically if any runtime error occurs - amitspandey - 01-14-2011

Hi ,
Well u can use this code:
use this below mentined code after nameing ur function
Code:
public function abc()

on error resume next
some code
.
.
.
at the end use thsi
if err.number<>0
reporter.reportevent micfail, err.number,err.description
else
reporter.reportevent micpass,"None of the Runtime Error occoured"
end if

if u use this code ur runtime error will be locked and ur Execution will not stop for sure.

Regards,
Amit