Self-healing TestCases

Self-healing Mode allows you to execute your TestCases without failing even if a control in your system under test has changed. Tosca then tries to find a similar control in the system under test. This ensures more stable test runs, reduces manual effort, and allows you to identify changed controls. When you use Tosca XScan, Tosca Rescan, or the Recorder, Tosca automatically adds the steering param SelfHealingData to your HTML controls.

Self-healing Mode

If you enable Self-healing Mode for your TestCase and Tosca fails to find the control during execution, Tosca tries to find a similar control in the system under test. If Tosca finds a suitable control, it uses this control instead of the missing control. The test execution continues without being interrupted by errors.

Enable Self-healing Mode

To enable Self-healing Mode, create a test configuration parameter (TCP) called SelfHealing with one of the following values:

  • Weighted: assigns a weighting algorithm to all self-healing properties to find the most unique control.

    Note that the weights for the weighting algorithm are calculated if you use Tricentis Tosca XScan or Tricentis Tosca Rescan. If you use the Recorder, you need to rescan your Module first.

  • Combination: creates all possible combinations of all properties that are stored in the steering param SelfHealingData to find a suitable control.

  • False: disables Self-healing Mode. Alternatively, you can leave the column empty. For instance, if you have enabled Self-healing Mode for a TestCase folder or even the entire project root element, you can set this value to disable Self-healing Mode for a specific TestCase only.

Optionally, if you use the Weighted value, you can limit the amount of combinations to find a suitable control. To do so, create a TCP called SelfHealingWeightThreshold and specify the threshold for the weight. The default value is 0,75, which means that all combinations that have a total weight of < 0,75 will be disregarded during self-healing. Note that depending on your regional settings, you need to specify the value with either a period or a comma as decimal separator.

SelfHealing and SelfHealingWeightThreshold TCPs

Note that Self-healing Mode may affect performance.

Use Self-healing Mode

When you create a Module with Tosca XScan, Tosca Rescan, or the Recorder, Tosca automatically adds the steering param SelfHealingData on the ModuleAttribute level. This param stores technical data of the HTML control. Tosca uses this data to self-heal a broken control.

To use Self-healing Mode during test execution, follow the steps below:

  1. Create a new TestCase with the ModuleAttribute that contains the steering param SelfHealingData.

  2. Enable Self-healing Mode for the TestCase.

  3. Create an ExecutionList for the TestCase.

  4. Run your ExecutionList.

Once you have run your ExecutionList, an icon on the ExecutionEntries indicates that the TestCase was self-healed. The Detail column of the ExecutionLog displays information on self-healed objects.

To apply self-healing changes to the Module, right-click the ExecutionLog and select Apply Self-Healing properties from the context menu.

Self-healing: execution result