Thursday, September 18, 2008

QTP GetLastError & DescribeResult

This is just a very simple example to show you how GetLastError and DescribeResult can be used.

[GetLastError returns the error code of the most recent error. You can use this statement together with the DescribeResult Statement. DescribeResult returns a text description of the specified error code.]

Make sure both QTP and sample flight applications are open and visible.

In a new test click on record and make a single click on the Flight Reservation window.


Click on stop in order to stop recording.

It will just record one line. Add GetLastError and DescribeResult lines as shown below in the final script.

Now make sure that Flight Reservation window in minimized, yes minimized! And Run the test.

Firstly it will show a Run Error as below

Just click Skip.

It will show you the message box with the error as below