Over a million developers have joined DZone.

How to Use Golden Masters to Check Web Apps With ReCheck

DZone's Guide to

How to Use Golden Masters to Check Web Apps With ReCheck

Check everything at once and create unbreakable tests.

· Performance Zone ·
Free Resource

SignalFx is the only real-time cloud monitoring platform for infrastructure, microservices, and applications. The platform collects metrics and traces across every component in your cloud environment, replacing traditional point tools with a single integrated solution that works across the stack.

Check everything at once and create unbreakable tests. Recheck is a Golden Master-based, open-source test framework on top of Selenium that comes with powerful features. Let's take a closer look.


  • Easy creation and maintenance of checks for web
  • Semantic comparison of contents
  • Easily ignore volatile elements, attributes, or sections
  • One-click maintenance to update Golden Masters with intended changes
  • No unexpected changes go unnoticed
  • Operates on top of Selenium
  • Makes your tests unbreakable
  • The Git for your GUI


Instead of manually defining individual aspects that you want to check, check everything at once. So instead of writing many assert statements — and still not have complete checks — write a single re.check(). This saves a lot of effort when creating tests. And it makes sure to not miss unexpected changes.

Even better: using the ReTest GUI (or the soon-to-come open-source CLI), you can easily accept those changes with a single click (patent pending). This also saves a lot of time during maintenance. Moreover, any regular changing aspects or elements (e.g. date fields) can easily be ignored.

And, using the Golden Master, recheck can identify elements even after the identifying attribute was changed. So assume you are using an HTML id property to identify an element within your Selenium test. Now, assume that this idproperty changes within the HTML. Then, your test would break, resulting in an NoSuchElementException. But using RecheckDriver as a drop-in replacement/wrapper of your normal driver magically finds the element and logs a warning such as:

Image title


Recheck operates on top of Selenium. Selenium has become an official W3C standard, supported by all major browsers. Learn more about Selenium and how to install it here.

Recheck is available as a Java API with support for JUnit 4 and JUnit 5, as well as TestNG.


Add recheck-web as a dependency through Maven Central:

Image title

Usage of Plain Recheck

Then, replace the assertions in your Selenium test. An example test could look like so (simplified):

Image title

Running such a test for the first time will result in the failure with an output like below:

Image title

Running such a test will also create a folder structure containing a retest.xml file and a screenshot per check (depending on your chosen names and configuration). These are now the Golden Master, the baseline in which future executions of this test are compared with. If you use version control, you should commit those files. Note that the retest.xml contains a full description of the rendered website, including all relevant information such as text, source, etc, and all non-default CSS attributes, such as font and margin. Although these files may become large, they are smaller than the original, and by ignoring specific (or all) attributes, you can configure how large they are. Anyways, storing a few kilobyte extra is much cheaper than the manpower needed to manually specify checks.

Executing the same test again should not result in any differences. But after changing the website and executing the test, you should see the test reporting your changes.

If you change a single CSS rule, you will find all elements that are affected by this change, like so:

Image title

Additionally, a file named replay.result will be created upon test failure, which is typically located in your target/test-classesfolder. This file can now be used to apply those changes to your baseline, using either the recheck-cli or the retest-GUI.

Usage of RecheckDriver/ "Unbreakable Selenium"

In order to use "Unbreakable Selenium," you just need to wrap your usual driver within a RecheckDriver (drop-in replacement) and use RecheckWebImpl instead of RecheckImpl. The code would the look like so):

Image title


This project is licensed under the AGPL license.

SignalFx is built on a massively scalable streaming architecture that applies advanced predictive analytics for real-time problem detection. With its NoSample™ distributed tracing capabilities, SignalFx reliably monitors all transactions across microservices, accurately identifying all anomalies. And through data-science-powered directed troubleshooting SignalFx guides the operator to find the root cause of issues in seconds.

selenium ,agpl ,gui ,performance ,retest ,recheck ,golden masters ,css ,html ,open source

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}