Estimate Project

An advantage of artificial intelligence in automation testing

by | August 15th, 2019

Time passes by; it’s not returnable and has no retry functionality, but testing technologies are improving even faster 🙂 

Today we are talking about artificial intelligence and how it can make our testing abilities both wider and easier. Before we move forward let’s roll back a couple of years and see how it used to be to test user interfaces with end-to-end tests.

Probably one of the most popular solutions was an ImageMagick library with its ability to insert into methods long passages of code, calculating page coordinates and drawing figures. After that, we could fill these figures with some color (also using code) and finally, one more method in our test needed to compare for example pixels of screenshots with a figure and without a figure. Wow! That’s a ton of coding! 🙂 Especially for an automation tester 🙂

And what do we have now? We have the ability to compare screenshots without any coordinate calculations and massive coding methods. AI solves this  time-consuming activity through its UI functionality. Some of the most popular AI tools for UI automation are Applitools, Percy, and Chromatic. For instance, Applitools can be built right into your end-to-end WebdriverIO code like a WebdriverIO service (dependency). And with only one line in a test it will do a couple things: take a screenshot, send it to the Applitools service, compare it with its baseline image, and react in a proper way on the results of comparing (!)

Once more, it scrolls the page all the way down, takes a couple of screenshots and combines them to form a full one. For instance, if we have a long column with a scroll on a page the final screenshot will look like this. 

The purple square on the picture above is a point of difference between these two screenshots. So the “checkpoint” (second screenshot) will be marked as mismatched and the test will fail.

The big advantage of Applitools is that you can compare not only a screenshot of a full page, but just some constant parts of the page which you need to test. (And without any knowledge about the page coordinates, ha (!)) It’s a really helpful solution because only in rare cases we need to compare the full page; mostly we test separate segments of a page.

I hope you enjoyed reading this article and will take advantage of AI in your automation testing!  

Take care!

Tags: , , , , ,