By: Jayati
April 25 2019

7 Automated Visual Testing Tools For You

Studies suggest that 90% of user abandonment of an app, website or online shopping cart can be attributed to visual bugs. This churns out from a simple fact that visual deformities is the first thing your user sees when they land on your website or app. 

What affects the look of the site is the testing of your site for the introduction of bugs(regressions). When you make additions or tweak styles and push the changes on the site, inadvertently, the layout of the page can get equally affected. For example, a tweak to the footer layout might break the mega menus in a subsection of a site. Thus, visual regression testing comes to the rescue, a process that helps in catching those differences and allowing you to compare two sets of screenshots to find the error. However, the pressure to achieve quicker results and shorten release cycles gives little time for testing but no room for error. Fortunately, there is an alternative: Automated Visual Testing.

Automated Visual Testing is a quick and reliable method designed for devices, browsers, operating systems and form factors to automatically validate the functions. 

Let’s discuss the concept, industry best practices and tools that can become key points to the success of websites and apps.

blue and grey corded electronic device on top of black device

Understanding Automated Visual Testing 

Automated visual testing system requires to validate the visual aspects and elements of an application’s user interface. It focuses on the correctness of content and layout being positioned properly on screen in respect to size and shape. It also checks for overlaps, hiding elements or visual mismatching contents along with correct font, colour and image.  

When performing visual testing, software vendors have two options: either manually test it or build an in-house tool to perform an ad-hoc visual test automation. Starting with manual testing, it’s a slow and expensive process above being prone to errors and being insufficient for a large matrix. On the other hand, Ad-hoc automation requires to manually maintain a baseline of expected screen images for the various resolutions, browsers and devices that must be constantly updated as the application evolves. When it comes to testing, the key is to determine what and how much to automate the testing. Too much can become bothersome from the maintenance perspective, and too little can suffer the quality of the website in question. 

So, what can we expect from a practical visual test automation tool?

Cognitive Ability

The testing tools must automatically categorise the content, layout or appearance defect to pinpoint the defect causing specific UI elements. The tool should be able to highlight and resolve each detected change only once. 

Baseline Management

The ability to collect and partition expected UI images for each distinct execution environment of the application (browser, device, screen form-factor) automatically. For instance, the iOS application’s appearance is substantially different on iPhone vs iPad. Thus, the execution should automatically reflect onto other environments to simplify maintenance.

Footprint

The tool must preserve both, the expected baseline image and the actual image showing the defect. It should have enough storage footprint to employ extreme image compression techniques to exist forever along with the bug entry without resulting in explosion.  

Scalability

The size of the enterprise or project should not hinder the number of tests running in parallel and there should be a seamless process to fit all needs. 

Challenges with Automated Visual Testing

The basic difference in terms of visual testing between humans and machines is that they perceive pixels differently. What will appear entirely identical to a human will have 1:1 algorithm for the system. This can take place between browser versions, underlying hardware changes on your cloud platform, and similar situations. Consequently, how images, drop shadows, etc are rendered can differ too. 

However, more robust services combine Machine Learning and heuristics to solve this issue where the system is trained to differentiate between acceptable and non-acceptable variations. While the machine has a different graphic card than the testing server and other developers, they are trained to ‘’see’’ as we do and move beyond the pixel level. Another issue is posed by the speed of the tests. Often the tests are compared to more lightweight unit tests that don’t require a full browser. 

If your time and effort are getting drained and you have experienced the gap in the testing processes, try out a practical visual test automation tool from this list: 

7 Tools For You

Selenium

Text 'Se' in a grey box with a green tick on top right

An open source platform, Selenium supports multiple programming languages, including Java, Python, C#, PHP, JavaScript, Ruby, and Perl. The tool can directly communicate with a browser to automate the testing offering a limited but useful prototyping plug-in, Selenium IDE, which can record actions and use them to future reference in testing.

Pros 

  • In the market for over a decade, the tool has acquired massive support and an active community. 
  • It allows to run simultaneous tests on different browsers at different machines, reducing the testing time for valuable and big projects. 
  • You can utilise the skills to test mobile web, hybrid or native apps using Appium with the same API as Selenium WebDriver.  

Cons

  • If you are a beginner, you might face issues with writing scripts that require a technical capability. 
  • There’s no provision to check for images being displayed or loaded correctly. Developers have to do it manually or using another library. 

Gemini

Built to run via either Selenium or PhantomJS server, Gemini packages an interface that isn't too complicated. It provides for ‘test suites’ that can provide organised codes and ease the whole process of testing for you.  It has a very nice documentation and is built entirely in NodeJS  requiring its own config file.

WebdriverCSS

Similar to Gemini, WebdriverCSS depends on Selenium for its functionality. Being a part of WebdriverIO ecosystem, it hooks benefits from the main framework and provides a better experience. It can also integrate well with other software like Mocha, Jasmine and Cucumber.js.

Watir

Logo in blue drop and text 'watir' on right

Even though it’s limited to web apps and works only on Windows, Watir is used by giants like Slack and Yahoo!. It has the capability of executing simple and easily maintainable tests being open source and basic in nature. 

Pros

  • One of the very few that allows writing scripts in Ruby programming language. However, if Ruby is not your language of choice, you can script with Java or .NET too. 

Cons

  • Being basic and simple also poses as a drawback as it can only be used in combination with other tools. 
  • The Watir community is smaller in size that leads to find folks who develop, document and contribute content to Watir on its website. 

Nightwatch

An owl as the logo with 'nightwatch.js' text on right

An end-to-end testing solution for browser based apps and websites, Nightwatch.js is written on Node.js. It is a simple yet powerful syntax that can enable you to write tests quickly, using only Javascript (Node.js) and CSS or Xpath selectors. A provision for flexible command and assertion framework makes it easy for developers to implement your application custom commands and assertions. It runs the tests in various combinations including sequentially and in parallel by group, tags or single.

Storybook

'S' in a pink box with text 'Storybook' on right

An easy to use tool for building a visual component library, Storybook allows you to browse a component library, view the different states of each component, and interactively develop and test those components. Also, using visual validation testing tools provided, it lets you do visual regression on all your components. 

Jest

Easy to configure and set up, this tool is a great fit for your developer folks when working on unit-level automated tests. Jest offers features like interactive watch mode which you can use for improving workflows. It’s smart enough to run relevant tests as per the changes you have made since your last commit to your code repository. It can also rerun the failing test from the previous run first which allows to find out changes required to fix those tests.

Conclusion

This seems to be enough as a list for you to get an idea about tools that you might want to introduce to your development team. Choose the best tools with OpenSense Labs and make sure your site is quality checked. Drop in at [email protected]