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

To do so, follow the steps below:

  1. Right-click the object and select Create Recovery Scenario Collection from the mini toolbar.

    The Recovery Scenario Collection applies to the following levels:

    • the object for which you have created it

    • all sub-items therein

Create a Recovery Scenario Collection for TestCase Insurance Quote for Automobile

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

  2. Determine what Tricentis 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

  1. Specify when Tricentis Tosca should apply the scenario. Enter one of the following values for the Recovery Scenario property RetryLevel:

    • TestStepValue: apply this Recovery Scenario if a TestStepValue fails

    • TestStep: apply this Recovery Scenario if a TestStep fails

    • TestCase: apply this Recovery Scenario if the TestCase fails

    The RetryLevel property also defines the point from which Tricentis Tosca resumes execution after Recovery.

    For instance, if you specify the value TestCase and a TestStepValue fails, Tricentis Tosca performs all TestCase Recovery Scenarios. After Recovery, Tricentis Tosca re-executes the entire TestCase from scratch.

    If you specify TestStepValue and a TestStepValue fails, Tricentis Tosca performs all TestStepValue Recovery Scenarios. After Recovery, Tricentis Tosca resumes execution at the TestStepValue in question and continues from there.

Recovery Scenario 1 applies to failed TestStepValues - execution resumes at the TestStepValue level

If you created your TestStep from an XModule whose property InterfaceType is NonGUI, you can only recover on the TestCase level.

Recovery Scenarios during execution

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.