The mabl blog: Testing in DevOps

Maintain Your Automated Functional Tests with Auto-Healing | mabl

Written by Chou Yang | Feb 16, 2018 3:00:00 PM

Solve Your Test Maintenance Problems

Automated functional testing is a must to test at the speed of continuous delivery, but maintaining test scripts takes up a lot of time. In most companies, UI elements are always changing. This means that test scripts are prone to failing not because the test truly failed, but because the UI changed and the test hasn't been adapted to it. Maintaining those test scripts results in a ton of overhead.   

When your tests do break, there’s not much information available to help you debug these brittle test failures - and that’s if you have the time to find and diagnosis them in the first place.

To counter these brittle tests and make your functional testing run seamlessly, mabl auto-heals your tests when something changes in your app's interface. Her test adaptation works by collecting lots of information about each of your UI elements during your tests, so that if the XPATH, name, CSS, etc., changes, she’ll be able to incrementally update what she knows about the element and then adapt in order to continue the test to completion.

Here’s a simple example of how this works.

We created three links, the first one leading to our team page (https://www.mabl.com/team/), the second one going to our home page (https://www.mabl.com/) and the third going to our blog (https://www.mabl.com/blog/), as buttons:

I'll train mabl to click on the link that takes us to our homepage, labeled “Does this go to home?”

To verify that mabl has clicked on the correct link, I'll create an assertion that the header on the page we end up at (which should be our homepage) contains “You code, mabl tests.”


I run through the test once and wait for it to pass:

Now let's see what happens when I make changes to the link in question.

I’ll change the XPATH of the element by embedding it within another div. I’ll also change the link color, text, and even the href. Before the test, I created a clone of the mabl homepage at https://mabl.com/clone in order to change the href while still allowing the assertion to pass. 

<div>

<a href="https://www.mabl.com/" style="background-color:#5bc4cd; font-size:20px; color:#FFFFFF;">Does this go to home?</a>

</div>

 

<div>

    <div>

   <a href="https://www.mabl.com/clone" style="background-color:#f19479; font-size:20px; color:#FFFFFF;">Indeed, it goes home!</a>

   </div>

</div>

So now my button looks like:

I run the test again, and it passes even with these changes. However, if I take a look at the output, I can see that mabl had to apply a workaround:

Upon test completion, I also receive an Insight from mabl prompting me to Accept or Reject this workaround. Accepting will tell mabl that she adapted the test correctly, and she’ll update the test for all future runs.

Testing teams on CD teams need maintenance-free functional testing, and mabl is leading the charge. Test adaptation is just one of the ways mabl helps your functional testing be smarter and less time consuming. If you want to try her out, she'll join your team for free at app.mabl.com.