Stops script playback, displays a message in the Errors pane, and adds the message to the run report. For example, you can use this statement if a script checks text against an expected value before it continues and the text does not match.
Fail statements are often used in conditional statement blocks. See Conditional statements. They can also be used in a Try block. See Try...Catch...Finally.
Note: The Warning statement can perform the same actions as the Fail statement without stopping playback.
Syntax
Fail("Message")
Arguments
| Argument | Description |
|---|---|
| Message | Failure message to display in the Errors pane and run report. |
Example
regValue = ReadRegistryEntry("HKEY_CLASSES_ROOT\\.qawscript", "")
If regValue = "QAWizardPro.Script" Then
PrintLn("Scripts entered correctly in the registry")
Else
Fail("Scripts not entered correctly in the registry")
End If