recheck-web
-web
recheck-web is a Golden Master-based test framework on top of Selenium that allows for easy creation and maintenance of more complete and nearly unbreakable tests. If you want to give it a quick try, checkout the Chrome extension that is based on recheck-web.
TL;DR
Imagine you could:
- Have your end-to-end tests actually fail when the website is broken or unusable (including visual regressions)
- Have your tests NOT fail when something as insignificant as an element ID changes
- Maintain your tests with minimal effort
recheck-web gives you these superpowers, and more.
Table of Contents
Example
A typical Selenium test could look like the following:
driver.findElement( By.id( "username" ) ).sendKeys( "Simon" ); driver.findElement( By.id( "password" ) ).sendKeys( "secret" ); driver.findElement( By.id( "sign-in" ) ).click(); assertEquals( driver.findElement( By.tagName( "h4" ) ).getText(), "Success!" );
If the website e.g. loses all of its CSS, thus rendering it essentially broken for a user, this test will still pass. However, if you change an invisible attribute that is irrelevant for a user, e.g. the element ID username
, this test will break.
By simply wrapping the driver in a RecheckDriver
and adding either a call to driver.capTest()
or our JUnit 4 or JUnit 5 extension, all of this changes. When the looks of the website change, the test will fail. And if the element ID changes, the test will still execute, albeit report the change—unless you chose to ignore it e.g. by specifying attribute=id
in your recheck.ignore
file (a file similar to Git’s .gitignore
).
Benefits
With recheck-web you can:
- Easily create and maintain checks in your tests
-
Perform deep visual testing that goes beyond the UI and doesn’t fail with every shifted pixel, i.e. semantically compare all of the contents, tags and CSS attributes of websites or
WebElement
s after rendering - Easily ignore volatile elements, attributes or sections, using a Git-like syntax
- Automatically maintain Golden Masters (and soon auto-heal your tests) with intended changes, using our GUI or CLI
- Be sure no unexpected change goes unnoticed
- Reuse your existing tests and infrastructure, as recheck-web operates on top of Selenium and is compatible with many test frameworks
-
Use a virtual constant
retestId
to reference elements, instead of element IDs, names, XPaths and other attributes that are prone to changes - Have virtually unbreakable Selenium tests
How It Works
Automated regression tests are not tests, in the sense that they don’t aim to find existing bugs. Instead, they guard against unintended changes. As such, they are an extension to version control—but today’s test tools are not optimized for this work flow.
recheck takes this to the next level. You can explicitly or implicitly create Golden Masters (essentially a copy of the rendered website) and semantically compare against these. Irrelevant changes are easy to ignore and the Golden Masters are effortless to update. In case of critical changes that would otherwise break your tests, recheck-web can now peek into the Golden Master, find the element there, and (based on additional attributes) still identify the changed element on the current website.
Quickstart
If you just want to quickly try recheck-web without the hassle of a full-project setup, we recommend using the Chrome extension that is based on recheck-web.
recheck-web 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.
Simply add recheck-web
as dependency to your project, e.g. via Maven Central: