Improve Your Testing #7: The checklist of AAA

How to use AAA to improve the quality of your tests.

David Rodenas PhD

--

«The referee is checking your test.» Prompted and edited by the author.

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.

--

--

David Rodenas PhD

Passionate software engineer & storyteller. Sharing knowledge to advance our skills. Join me on a journey of discovery in the world of software engineering.