Hermetic Testing

Hermetic Testing image
A hermetic test is a test that is completely self-sufficient. It is fully independent, therefore every time a test is run, you are absolutely sure that a failure is a real failure, and has nothing to do with a dependency going wrong.

In order to use hermetic testing to achieve what we want, we first split our e2e into meaningful chunks. The most common breakdown is to split it into frontend and backend systems.We then run our tests within the context of the front end and back end independently. 

We then add additional levels of tests to make sure we make up for skipping the e2e tests like contract tests, API tests, visual tests and improving existing unit testing coverage.
Hermetic testing to me is a method for ensuring that tests run consistently and offer a consistent value. If we apply the idea of Hermetic Testing to only the data element of a tests requirements, we can understand what this means.

Imagine there are three ways to handle data in our testing:

  1. Our tests can create their own data and then test that data
  2. Our tests could expect data to already exist, and choose something valid at random
  3. Our tests can expect specific data to already exist, and use the exact same data everytime they run
The third bullet point is how I imagine Hermetic Testing. Test-001 expects [item]to already exist, it navigates directly to the UID of [item] and performs the test.

This is a more scientific method of testing when compared to 1. and 2., because they inherently have risk built into them.

  1. In approach 1, if the data creation step fails, the test fails without even reaching the point it’s meant to test.
  2. In approach 2, if the assumed data isn’t present or changes unexpectedly, the test again fails for reasons unrelated to its actual assertions.
  3. In approach 3 (Hermetic Testing), the framework pre-seeds the required data in a known, stable state. As a result, tests should always run the same and in theoryonly fail when there’s a real bug.

This, to me, is the purpose of Hermetic Testing: to build a regression pack that executes exactly the same way, every single time, so that when a test fails, we can trust that something really broke.

The Future of Intelligent Quality is Here image
Smarter testing starts now with Sembi IQ, bringing AI-powered enhancements to TestRail, Xray, and Designwise.
Explore MoT
Xray AI in action: Test Case & Model Generation for modern QA teams image
Wed, 17 Sep
with Ivan Fillipov, Solution Architect at Xray
MoT Software Testing Essentials Certificate image
Boost your career in software testing with the MoT Software Testing Essentials Certificate. Learn essential skills, from basic testing techniques to advanced risk analysis, crafted by industry experts.
Leading with Quality
A one-day educational experience to help business lead with expanding quality engineering and testing practices.
This Week in Testing image
Debrief the week in Testing via a community radio show hosted by Simon Tomes and members of the community
Subscribe to our newsletter
We'll keep you up to date on all the testing trends.