Recovery & Clean up Scenario in Tosca

Recovery & Clean up Scenario in Tosca

A Recovery Scenario is a collection of test steps that Tricentis Tosca executes if the test fails.

The goal of Recovery is to fix failing test step values or test steps by employing “corrective” test steps.

Clean-up Scenarios are alternate scenarios that Tricentis Tosca executes if the test steps in Recovery Scenarios don’t return a positive result.

Creating a recovery scenario:

In general, while automating a business scenario we can expect one or more dynamic information or warning pop up based on the data that is used to steer a scenario. If those pop up are not handled it could potentially lead to failure of the test steps. In this case, we can create test objects as module and use it as test step in the recovery scenario to handle the pop up if appears and continue the flow of test execution.

  • A quick example for recovery scenario in demo web page.

Note: – Recovery scenario will apply only if the execution of the test case is done from the execution folder section. It will not apply if the test case is run in the scratch book.

The following settings must be updated.

  • In project -> settings -> TBox-> Recovery
tbox recovery

In demo web shop application, if search keyword is not provided as part of input data and when search button is clicked. A chrome alert pop-up appears with the message “Please enter some search keyword.

chrome alert pop-up appears with the message

Instead of using an “If statement” in the test case to handle the chrome alert pop up. A recover scenario can be created. The moment actual test case fails due to the pop up the recover scenario will be automatically triggered and once the recovery scenario returns a positive result status. The execution would continue with the test case. If the pop up does not appear and the test case doesn’t fail the recovery scenario will not be triggered.

Recovery Scenarios can be created for one of the following objects:

  • Test case folders – Right click on folder name “TestCases” to create recovery scenario for a test case folder.
Testcases
  • Test cases – Right click on test case created to create a recovery scenario for the test case.
recovery scenario for the test case

It is also important to specify the retry levels for the recovery scenario. Tosca supports the following three retry levels.

important to specify the retry levels for the recovery scenario
  • Retry Level – Test case
Retry Level - Test case

The recovery scenario will jump in to handle the pop up and returns the positive result. The retry of the test case will be from its first test step “DemoWebShop_OpenUrl” as the retry level value test case is selected.

  • Retry Level – Test step
the retry level value test case is selected

The recovery scenario will jump in to handle the pop up and returns the positive result. The retry will be from the failed test step DemoWebShop_SearchStore. Note: It will not re-trigger from the DemoWebShop_OpenUrl as the retry level selected istest step.

  • Retry Level – Test step value
retry level selected is test step

If the retry level is set to test step value. In this case, if the test step value “Books” fails due to the Chrome alert pop up.  The recovery scenario will handle the pop up and the retry will continue from the failed test step value “Books”.

Clean up Scenario:

It is important every time to keep the test environment clean before each test execution. If a test scenario fails, the collection of recovery scenario will trigger if created any. If the recovery scenario fails. The clean-up scenarios will be triggered, and it can include post execution steps like close the applications to make the next test case executable.

Steps to create a cleanup scenario:

Right click on the recovery scenario folder and click on the brush icon to create a clean-up scenario.

Steps to create a cleanup scenario

Clean Up Scenario is created. Now the list of test case as part of clean up scenario can be added.

Clean Up Scenario is created

Leave a Reply

Your email address will not be published. Required fields are marked *