In my previous article, I discussed the basic concepts of Visual Regression Testing. Now, let's delve deeper into defining a visual testing architecture based on a business model.
Since technology is constantly changing, architectural decisions require a lot of careful consideration. We need to think about how sustainable, maintainable, and scalable the source structure is in order to make a tailored decision. In this article, we're skipping the technology decision and focusing on the visual testing architecture decision. We'll take a look at two case studies, go through the design thinking process, and end up with a solution for each case.
The first step is to analyze the context of the project and see which visual testing architecture fits best. Start by interviewing your PO, or whoever best knows the visual regression testing needs of the project.
Here are a few questions that should help you gather information. These questions can serve as a base, but make sure to also include any questions that are specific to your project.
With those questions answered, we're ready to move forward!
Now that we're familiar with the business, we can start thinking about the visual testing architecture. For this, we also need to have some questions answered:
These are some of the questions you can ask yourself to help figure out the best visual testing architecture for your business needs.
The next step would be to analyze the information acquired and come up with a solution.
At this point, you'll be able to define:
Now, let's get to some real cases and put the steps together.
Here are two case studies we're going to use as examples. Take some time to go through them in order to gain a better understanding of the information gathered from steps 1 and 2, as well as the proposed solutions in step 3.
Here's the URL for the first case study: https://www.avenuecode.com/
Information gathered:
By analyzing the business, we can conclude that there's no big need to conduct visual regression tests because there aren't a lot of CSS changes. However, if the company allows for investment, we can run a check for the most important components such as headers, menus, footers, contact page, and careers page for a desktop and mobile browser. The visual regression test source code will be different from the functional tests. Check out the second case study for more details.
Here are the URLs for the second case study: https://www.fansedge.com/ and https://www.collegebasketballstore.com/
Information gathered:
By analyzing the business side, we're able to see a high need for visual regression tests because there are large amounts of CSS changes, some of them specific to only one or two brands. One of the challenges is working with dynamic areas, so we need to have a large coverage with regards to visual regression testing - mainly component oriented, since we reuse components throughout many pages. We also need to be able to work with different browsers and resolutions, such as for tablets and mobile devices. The number of different websites is projected to increase approximately every quarter of the year as well.
For both cases, we decided on decoupling the visual regression testing from the functional testing for the following reasons:
To sum up, we went through the steps proposed to build a good architecture solution by identifying the business needs and brainstorming the architecture. Now that we understand the needs, it's time to build some examples and evaluate the results for your particular situation.
In the next article, we'll implement the topics we just discussed in a visual regression test project for these two use cases. I'd love to hear back from you! Let me know if you found this article to be helpful, and feel free to send over any questions you might have.