Create a Recovery Scenario

Once you have enabled Engines 3.0 Recovery, you can create your Recovery Scenarios. A Recovery Scenario is a collection of TestSteps that Tricentis Tosca executes if particular tests fail.

You can create Recovery Scenarios for one of the following objects:

  • TestCase folders

  • TestCases

Recovery Scenarios apply to the object itself and all its child objects. For example, if you add a Scenario to a TestCase folder, it applies to all TestCases in the folder.

Add a new scenario

To add a Recovery Scenario, follow these steps:

  1. Right-click a TestCase folder or a TestCase and select Create Recovery Scenario Collection from the mini toolbar.

Create a Recovery Scenario Collection for TestCase Insurance Quote for Automobile

  1. Right-click the new folder *** Recovery Scenarios *** and select Create Recovery Scenario from the mini toolbar. You can create several Scenarios in one folder.

  2. Define what Tosca should do if tests fail. To do so, add TestSteps to your Recovery Scenario. You can either use existing TestSteps, or you can create them via Fuzzy Search.

    For instance, the TestStep Home - Select "Automobile" steers a control on a website. A possible Recovery Scenario could be to close and reopen the browser tab.

Recovery Scenario: close and reopen the browser tab

Define a RetryLevel

The RetryLevel of a Recovery Scenario determines the following things:

  • When Tosca applies the Scenario: TestStepValue, TestStep, or TestCase failure.

  • Where Tosca resumes test execution after a successful Recovery.

To define the RetryLevel, select your Recovery Scenario and open the Properties pane. Then pick a value for the property RetryLevel.

Think about what makes most sense from a test execution standpoint.

If you set the RetryLevel to TestCase and a TestStepValue fails, Tosca performs all TestCase Recovery Scenarios. If one of them is successful, Tosca re-runs the entire TestCase from scratch. Typically, that's not the best choice, for example if the TestCase has preparatory steps like opening an application and signing in. If the application is already open and the user already signed in, Tosca runs into a new set of issues when it tries to repeat these steps after Recovery.

In this screenshot, Recovery Scenario applies whenever TestStepValues fail. If Recovery is successful, Tosca resumes test execution with the initial failed TestStepValue and then continues from there.

Recovery Scenario with a RetryLevel for TestStepValues

If you created your TestStep from a Module whose property InterfaceType is NonGUI, you can only recover on the TestCase and TestStep levels.

Recovery Scenarios at runtime

You create your Recovery Scenarios in the TestCases section. Tricentis Tosca automatically applies them during execution (see chapter "Work with Engines 3.0 Recovery"). A Recovery Scenario is successful if all TestSteps therein return a positive result.

During execution, Tricentis Tosca looks for applicable scenarios on the closest level.

  • If there are several applicable scenarios, Tricentis Tosca executes them top-to-bottom.

  • If there is no applicable scenario, or if none are successful, Tricentis Tosca looks for applicable scenarios on the next-higher level. If there are none, or if none are successful, Tricentis Tosca moves on to the next-higher level until there are no more levels left.

  • Then Tricentis Tosca moves back to the closest level and looks for the next-higher Recovery Scenario.

    For instance, if none of the TestStepValue Recovery Scenarios were successful, Tricentis Tosca moves on to TestStep Recovery Scenarios. First on the closest level, then on the next-higher level, etc.

This process continues until a Recovery Scenario is successful, or until there are no more Recovery Scenarios left.

If one of the Recovery Scenarios is successful, Tricentis Tosca resumes execution from the point specified in the Recovery Scenario property RetryLevel.

If no Recovery Scenario is successful, Tricentis Tosca reports the TestCase as failed.

Example

In the TestCase folder below, you have defined Recovery Scenarios on two levels:

  • The Sub-folder level contains three scenarios for failed TestCases, one scenario for failed TestSteps, and one scenario for failed TestStepValues.

  • The TestCase level contains three scenarios for failed TestSteps and three scenarios for failed TestStepValues.

Example test structure

If a TestStepValue fails, Tricentis Tosca performs the following actions:

  • It searches the closest level, i.e. the TestCase level, for TestStepValue Recovery Scenarios and executes them: Recovery Scenario A for TestStepValues, Recovery Scenario B for TestStepValues, and Recovery Scenario C for TestStepValues.

  • These scenarios are unsuccessful, so Tricentis Tosca moves on to the next-higher level, i.e. the Sub-folder level. On this level, it executes Recovery Scenario D for TestStepValues.

  • This scenario is unsuccessful, so Tricentis Tosca moves back down to the TestCase level and on to the next-higher Recovery Scenarios, i.e. TestStep Recovery Scenarios.

  • Tricentis Tosca executes Recovery Scenario (1) for TestSteps, Recovery Scenario (2) for TestSteps, and Recovery Scenario (3) for TestSteps.

  • These scenarios are unsuccessful, so Tricentis Tosca moves on to the Sub-folder level. On this level, it executes Recovery Scenario (4) for TestSteps.

  • This scenario is unsuccessful, so Tricentis Tosca moves on to the next-higher Recovery Scenarios, i.e. TestCase Recovery Scenarios.

  • It executes Recovery Scenario (I) for TestCases, Recovery Scenario (II) for TestCases, and Recovery Scenario (III) for TestCases on the Sub-folder level.

If one of the TestCase Recovery Scenarios is successful, Tricentis Tosca re-executes the TestCase from the beginning.

If none of the TestCase Recovery Scenarios are successful, Tricentis Tosca reports the TestCase as failed.