Skip to main content

Quality Assurance

Understanding Self-Healing Object Exclusion in Katalon Studio

Istock 1333943998

Introduction

Katalon Studio’s Self-Healing Mechanism is a powerful feature designed to address common challenges in test automation, particularly the NoElementFoundException. This mechanism automatically repairs itself by searching for alternative options when a test object cannot be located, enhancing the stability of test scenarios. Understanding how to utilize and exclude objects effectively in this process is crucial for successful automation testing.

Overview of Self-Healing Mechanism

The Self-Healing Mechanism in Katalon Studio continues to search for alternative options when a test automation script encounters difficulties finding a test object. By prioritizing methods like Xpath, Attributes, CSS, and Image, it aims to mitigate the problem of failing to locate test objects, thus ensuring smoother test execution.

Activating and Configuring Self-Healing:

  • Activation: The Self-Healing Mechanism is enabled by default when creating a web-based project in Katalon Studio. Users can verify its activation during project setup.
  • Configuration: Users can choose to employ one or more of the supported locator methods and prioritize them using checkboxes and arrows. This allows for customization based on specific project needs.

Excluding Objects from Self-Healing:

  • Purpose: The Self-Healing Mechanism is primarily intended for interacting with web objects and not suitable for verification or comparison methods.
  • Exclusion: Users can utilize the Self-Healing menu to exclude methods that should not be applied, ensuring that the mechanism focuses on object interaction rather than verification tasks.

Applying Self-Healing Mechanism:

During test execution, if a test object poses an issue, a SELF-HEALING warning will appear, indicating that alternative choices are available. Users can select preferred alternative test objects from the Self-Healing Insights tab, which provides details about unavailable test objects and their replacements.

However, the self-healing mechanism is primarily intended for interacting with web objects. You can utilize the Self-Healing menu to exclude methods or objects by specifying relevant keywords.

Self-Healing Object Exclusion

Katalon Studio’s Self-Healing Object Exclusion feature is a valuable tool for managing unfound web objects during automation testing. By effectively activating, configuring, excluding objects, and applying the self-healing mechanism, testers can significantly enhance the stability and reliability of their automation projects.

While Self-Healing Mode is incredibly useful, there are situations where you may want to exclude certain keywords from its operation. For example, keywords like verifyElementPresent and verifyElementNotPresent typically do not require object location adjustments since they are specifically designed to check for object existence. In such cases, attempting to locate non-existent objects may lead to unnecessary test failures and false positives.

Implementation Example:

Let’s consider a scenario where we have a test script that includes the verifyElementPresent keyword. By adding this keyword to the exclusion list in Self-Healing Mode settings, we can prevent Katalon Studio from attempting to self-heal objects used with this keyword. As a result, if the object’s locator is broken, the test will fail as expected, without unnecessary attempts to locate the object.

Katalon Studio’s Self-Healing Object Exclusion feature is a valuable tool for managing unfound web objects during automation testing. By effectively activating, configuring, excluding objects, and applying the self-healing mechanism, testers can significantly enhance the stability and reliability of their automation projects.

To configure self-healing object exclusion in Katalon Studio, follow these steps:

  1. Activation:
    • The Self-Healing Mechanism is enabled by default when creating a web-based project in Katalon Studio.
    • To verify its activation, navigate to Project > Settings > Self-Healing > WebUI and check or uncheck the box for “Enable Self-healing execution”.

      Picture7

      Fig: WebUI Setting

  2. Locator Methods:
    • During a web-based project setup, Katalon Studio’s Self-Healing supports four locator methods: XPath, Attributes, CSS Selector, and Image.
    • By default, it will attempt to find the test object via XPath. If not found, it will sequentially explore the other test object methods until it finds a match.
    • Users can choose to use one or more of these methods by selecting or deselecting the corresponding checkboxes.

      Picture8

      Fig: Locator Methods

  3. Prioritization:
    • Users can prioritize the order of alternative methods by moving them up and down in the settings.
    • This prioritization determines the sequence in which Katalon Studio will search for alternative test objects if the default locator fails.
  4. Exclusion:
    • To exclude specific methods or objects from self-healing, utilize the Self-Healing menu and specify relevant keywords to prevent Katalon Studio from retrying to locate those objects.

Some best practices for configuring self-healing object exclusion in Katalon Studio:

  1. Enable Self-Healing: Ensure that the self-healing mechanism is enabled in your project settings. This can be found under Project > Settings > Self-Healing > WebUI.
  2. Prioritize Selection Methods: Katalon Studio supports four selection methods for spying and recording Web UI tests: XPath, Attributes, CSS, and Image. You can prioritize the order of these methods in the Self-Healing window, which is accessible from the toolbar or Project > Settings > Self-Healing > WebUI.
  3. Exclude Objects: To prevent Katalon Studio from retrying to locate specific objects, you can exclude them using keywords. This can be done in the Self-Healing window.
  4. Analyze Self-Healing Insights: After a test run, if Katalon Studio applied Self-healing to an object, it will be shown in the Self-healing Insights tab. This tab displays information such as the ID of broken test objects, the default locator that couldn’t detect the object, the proposed locator that located the object, the selection method used, and a screenshot of the healed object. You can use this information to decide which locator to take action on.
  5. Approve Changes: If the self-healing mechanism locates an object using a different method, you need to approve the change to make it permanent. This ensures that the test script stays up-to-date with each change.

 

Conclusion

The Self-Healing Object Exclusion feature in Katalon Studio offers a robust framework for managing unfound web objects during automation testing. By understanding how to activate, configure, exclude objects, and apply the self-healing mechanism effectively, testers can enhance the stability and reliability of their automation projects. For more detailed insights and practical application tips, users can refer to official documentation and resources provided by Katalon Studio.

 

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Sanket Dudhe

Sanket Dudhe is a Technical Consultant at Perficient. He has an experience of 4+ years as SDET. He loves technology and hence is curious to learn about new emerging technologies #lovefortechnology.

More from this Author

Categories
Follow Us