QuestionQ109

Debugging

When an exception occurs while a test case is executing, it is desirable to fail the test case and capture a screenshot of the application's current state. Which of the following strategies can achieve this?

  • A Surround the test case in a Try CatchAdd a Verify Expression in the Catch Exception block, configured in the following way:TakeScreenshotIfFailed: False -Expression: False
  • B Surround the test case in a Try CatchAdd a Verify Expression in the Catch Exception block, configured in the following way:TakeScreenshotIfFailed: True -Expression: True
  • C Surround the test case in a Try CatchAdd a Verify Expression in the Catch Exception block, configured in the following way:TakeScreenshotIfFailed: True -Expression: False
  • D Surround the test case in a Try CatchAdd a Verify Expression in the Finally Exception block, configured in the following way:TakeScreenshotIfFailed: True -Expression: “1 > 2”
Explanation

A Verify Expression activity whose expression evaluates to False produces a failed verification. Setting TakeScreenshotIfFailed to True captures a screenshot when that verification fails. Placing it in the Catch block performs both actions after the original exception is caught.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!