No, not the best tests that we can code
An automated atomic test (AAT) is one that tests only a single feature or component. An AAT should form a single irreducible unit. An automated test should not do something like end-to-end automation.
We can usually tell that a test is atomic when:
- The test will only have one assertion or two assertions at most. Because sometimes we need one assertion to make sure our state is correct
- Atomic tests have very few UI interactions and they’re only on a maximum of two screens. In rare cases, an atomic test might navigate through 3 screens (although I’d like to see this example)
- Atomic tests fail fast
- Atomic tests decrease flaky behavior
- Atomic checks allow for focused testing
- Atomic tests are short and fast
As an aside, this concept is already well understood in unit and integration tests, but UI tests continue to lag behind.
- Find the functionality that you want to test
- Isolate/Mock/Fake all irrelevant actions
- Test the relevant feature through UI
Let's take a look at how a login and cart functionality works at the code level
- 🏋️♀️Go to E2ETests.java and follow instructions in
userCanCheckoutAtomic()
to create an atomic test that validates checkout logic - Don't forget to run the test until it passes
- Massively increase browser coverage
- Drastically decrease the code we need to maintain
- Drastically increase test suite stability