Skip to content

Commands for Exception Handling

These commands are built to implement exception handling within your automated tests so that during run-time if exceptions/errors were to occur, the logic implemented within the tests can gracefully handle the exceptions/errors. 

An exception is an event that usually disrupts the normal flow of your automated test. Worksoft SaaS supports a number of commands that allow you to implement best practices in gracefully handling exceptions that may arise during the run-time execution of your automated tests.

You can read about the purpose of these powerful commands in this article.

The table(s) below list the commands in the ascending alphabetic order within each category along with a brief description of the purpose behind the command. By clicking on the hyperlinked command name in the table(s) below, you can review more detailed information about a specific command that includes the syntax for you to follow when using the commands.   

Please note that these commands (constructs) are supported within the Worksoft SaaS application (Edit Test Script screen) only and NOT supported in the QaSCRIBE test authoring tool.
Command Purpose
continueRunFromLastFailedInstruction This command will continue the execution by re-executing the last failed instruction. If it fails for the second time, then the ExceptionHandler code is not invoked again to avoid the cyclic condition.
getErrorTextForLastFailedInstruction This command allows you to retrieve the error text of the last failed instruction and also optionally pass command name in the value field. If the command name is passed then it returns the error text of the last failed command.
getFailedInstructionId This command is used to get the Instruction Id of the last failed command within the exception block.
getFailedInstructionCommand This command is used to get the last failed command in a Test Run within the exception block.
getFailedInstructionTarget This command is used to get the target of the last failed command in a Test Run within the exception block.
getFailedInstructionValue This command is used to get the value of the failed command in a Test Run within the exception block.
setExceptionHandlerContext This command is used to set the Test script to handle any exceptions during the Test Run.
In case of any exceptions (failures), the Test Script pertaining to the exception handling will be executed as part of the Test Run
within Exception Handler Code.
Status of the Test Script can be optionally passed. Allowed values for Status are 'W' and 'A'.If not passed, the status of the test Script is assumed to be W for WIP.
setMarkerForPointOfFailure This command will mark a point of failure within the executed test by setting the execution outcome of a test instruction that uses this command to 'failed'.

Feedback and Knowledge Base