October 14, 2010

QA Wizard Pro Exception Handling

Helix ALM
One of the more popular feature requests from QA Wizard Pro customers is exception handling. We added two well-known exception handling techniques to QA Wizard Pro 2011: Try...Catch statements and On Error statements.

Try...Catch statements

With the Try...Catch statements, you can run a block of statements in a script and continue playback in the Catch block of conditions if an error occurs. You can use a number of error statements, such as Err.Description, with the Catch statement to return error details. You can print error information or even send it to your defect tracking tool. The following screenshot includes a basic script that uses the Try and Catch statements. You'll also notice a Finally statement in the script. This statement allows you to always execute a statement if the script statements in the Try block passed or failed. [caption id="attachment_5805" align="alignnone" width="550" caption="Try and Catch Exception"]Try and Catch Exception[/caption]

On Error statement

The On Error statement sets the error handling behavior of a script, function, or subroutine. In this script example, the On Error statement indicates that QA Wizard Pro should try to execute the next script step if it runs into a step that cannot execute. You could also use On Error Goto 0 to stop the script execution when the error is encountered. [caption id="attachment_5809" align="alignnone" width="478" caption="On Error Exception Handler"]On Error Exception Handler[/caption] Both exception techniques will be used in different script scenarios. My personal favorite is the Try and Catch statement because of my programming background. Check out the 'Improving QA Wizard Pro Script Resiliency' webinar recording to learn more about both exception handling techniques.