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 create a Module with Tosca XScan, Tosca Rescan, or the Recorder, Tosca automatically adds self-healing properties to the Self-Healing Properties tab of the ModuleAttribute. These properties store technical data of the HTML control. Tosca uses this data to self-heal a broken control.

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:

Value

Description

Weighted

Assigns a weighting algorithm to all self-healing properties to find the most unique control. The accumulated weight of all matching properties defines if Tosca considers a control as a suitable control during Self-Healing mode.

When you use Tosca XScan or Tosca Rescan, Tosca automatically calculates the weight of each self-healing property. If you use the Recorder, you need to rescan your Module first.

Optionally, you can limit the amount of algorithm 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 (0.75), which means that all combinations that have a total weight that's smaller than 0,75 (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.

Combination

Creates all possible combinations of all properties that are stored in the self-healing properties 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.

SelfHealing TCP

Note that Self-healing Mode may affect performance.

Use Self-healing Mode

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

  1. Create a new TestCase with the ModuleAttribute that contains the self-healing properties.

  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

Modify your self-healing properties

When you use Tosca XScan, Tosca Rescan, or the Recorder, Tosca automatically preselects self-healing properties during scanning and adds self-healing properties to the Self-Healing Properties tab of the ModuleAttribute after scanning. These properties store technical data of the HTML control. Tosca uses this data to self-heal a broken control.

Edit self-healing properties during scanning

To edit the preselected self-healing properties during scanning, follow the steps below:

  1. In the Advanced View, select the control.

  2. Click on Self-Healing Properties.

  3. Select or deselect the self-healing properties.

Self-Healing Properties in the Advanced View

Edit self-healing properties after scanning

You can edit and delete existing properties, or add new self-healing properties after scanning. To modify your self-healing properties, follow the steps below:

  1. Select the ModuleAttribute of the Module.

  2. Click on the Self-Healing Properties tab of the ModuleAttribute.

  3. Optionally, click into the Name field of the property to rename it.

  4. Optionally, right-click the property and select Delete to delete it.

  5. Optionally, click on Add new property and select the param that you want to create.

    The default Weight for newly added properties is -1, which means that Tosca disregards the weighting for this property when you use the Weighted value for Self-Healing mode. If you want Tosca to calculate the weighting for the property, you need to rescan your Module first.

Self-Healing Properties view