Improve Your Testing #6: The One Algorithm To Test Them All
Learn how to use Arrange-Act-Assert to improve your ability and quality of testing
Have you noticed that in software development there’s an algorithm for everything? Sorting data? There are algorithms for sorting. Finding the shortest path? There’s another algorithm. And so on. But when it comes to implementing software tests, if your code does what it’s supposed to do, there is one algorithm to rule them all.
Fascinating, isn’t it? Normally, we tend to overcomplicate testing, but there is one single algorithm that makes it simple: the AAA. It leaves out all the noise and focuses on what really matters. And you don’t even need to be a great developer to follow it; it’s within everyone’s reach.
The one algorithm to test them all
We might find it surprising that there’s only one algorithm, which is nothing more than a way to structure test code, but it’s not. It creates a structure that brings simplicity to this chaotic world of testing. And even more, there’s no other more efficient way. And it comes out of necessity. Because testing must be simple, simple enough not to need a test for the test. And this AAA gives us this simplicity along with the effectiveness we need.