Visual testing should be an important element in the test strategy for any online application. Why? Because it's about testing what the user sees -- one of the most critical aspects of UX.
Visual testing verifies that what the user sees on each screen matches the design requirements. It's a specialized part of UX testing; it is not functional testing.
Most visual defects relate to how images and text are rendered on the screen. When a consumer cannot read the next steps or prices or is unable to find a submit button, sales and customer loyalty may be lost. Another example would be where a patient accesses a medical records application and finds that test results or medication instructions are not readable. In this situation, visual defects could result in serious physical harm or worse.
Let's examine the dos and don'ts of visual testing. We look at how and what to include in your visual test approach, when to execute visual testing and how to effectively automate visual testing.
The dos of visual testing
Ensure that the specifications are detailed. This is an especially critical prerequisite for automated visual tests. Your visual tests are only as thorough as the design specifications from which they are built.
Plan your visual test schedule appropriately. Although it is important to run functional testing prior to extensive visual checks, visual testing should begin during unit testing so that design errors are caught and fixed early in development.
Include both static and dynamic visual testing in your test strategy.
Static visual testing is used to manually verify at the screen level; screens are compared across various platform, browser and device combinations. At a high level, testers can do this manually.
Dynamic visual testing inspects how the screen reacts when action is taken, such as clicking a radio button. Record and playback tools can be used to find and document dynamic visual defects.
Depending on the nature of the application under test, you might need to execute other types of visual testing. Some of these include color contrast testing, responsive web design testing, iconography testing, visual accessibility testing and layout testing. Consider these as you develop your accessibility test approach.
Visual testing must be comprehensive. Test element by element on each screen, and test all required screen sizes, orientations and fonts in each of the platform, browser and device combinations. This volume of testing requires specialized automation tools that compare elements across various combinations of screens and devices.
Although it can be necessary to use risk-based analysis in the choice of combinations, it is important to cover as many as is practical. Defects are often specific to certain combinations.
Visual test automation tools compare an application to specifications at the pixel level. It is possible to begin with your functional test scripts and add Applitools' Eyes SDK to add the visual test component. In addition, Percy and LambdaTest also provide tools that can be used to integrate visual testing into your automated test strategy.
And remember to include visual testing into your CI pipeline and in production monitoring systems so that defects can be found and addressed as early as possible.
The don'ts of visual testing
Don't assume that you can merge visual testing into your functional test automation. Although it may be technically possible, it isn't efficient. To cover all required screen sizes, screen orientations and fonts in every OS, browser and device combination, your automated suite would become unwieldly and run so long that it would become ineffective.
Don't assume that complete visual testing can be done manually. Although your manual testers can find glaring rendering errors, it is virtually impossible to effectively compare all the design specifications to what is on the screen. Furthermore, visual testing requires specialized UX testing skills, as well as an in-depth understanding of design. Even the manual components of visual testing are best done by UX professionals.
Don't apply visual testing to every application. Since it is time-consuming and, therefore, costly, visual testing should be conducted only on applications that have UIs and are used by external customers.