Improve Your Testing #7: The checklist of AAA
How to use AAA to improve the quality of your tests.
In the previous article, I introduced the AAA, the unique algorithm for any test. A simple algorithm that serves as a template and structure for everything. I even gave a top to simplify test creation: if AAA is Arrange-Act-Assert, I proposed that it’s better to start with Act, checking what we want, even if not everything is in place. The AAA provides a simple way to write any test, but what about the tests we’ve already done? How can we improve their quality? Or even more… what if we failed to follow AAA correctly? Is there something else we can follow to keep improving? Well, yes, and that’s precisely what we’ll discuss in this article.
Quick review
Before we start, though, a quick review of this magical AAA algorithm.
AAA stands for Arrange-Act-Assert, that is a template for writing tests that defines three different stages. The arrange stage consists of doing all the initializations, and in short, starting up the part of the software we want to test and getting it ready for the action we want to do. Act is simply executing the action we want to test, and plainly, the only reason for doing the testing. And Assert is checking that the result has been correct.