Today we are going to take you through Huxley, an open source visual regression testing tool which was built by Pete Hunt at Instagram. If you would like to manage all your captured expected images inside your own repository instead of saving them in cloud and to explore free/opensource options for visual regression testing, then we would strongly recommend Huxley.
To start with we would like to answer the following question – Which is the appropriate time to go for Automated Visual Regression testing? Consider the following scenario, one of your automated tests is just filling values in few textboxes and clicking a button on a page. Once the execution is completed, the result will indicate whether the expected action is performed or not. However, it won’t report you the missing images and something doesn’t look right on the UI.
Our recommendation: Use static data to perform automated visual regression testing. So that you will not get screenshot mismatch errors due to test data change. Eventually, we are trying to avoid false positives.
Huxley uses Selenium WebDriver to launch an URL and records actions. To save an expected screenshot, you need to press enter on Huxley Terminal. The recorded steps and screenshots will be used to playback and compare the actual screenshots. Note: Huxley is no longer supported or updated by Facebook or Instagram. You can fork it to customize the project.
You can playback the recorded scripts and it will report the failures if there is any screenshot mismatch. By default, Huxley will overwrite the old screenshots with the new ones. Which means you don’t have to rewrite anything when your UI changes like you would with a traditional WebDriver test — Huxley will just take a new screenshot for you and when it’s checked in your test is updated!
We have already forked this project and making some improvements. We will publish a blog article soon with technical details & sample snippets.