There are unit tests, integration tests, API tests, end-to-end tests and other “test” animals. (No animal was tested for this post).
These types of tests are based on what they test. Unit tests test a code unit – a method, a class, a small set of classes. An API test checks our API behaves properly.
Micro-tests can be understood the same way: They test a very small portion of code (sort of a unit test). However, that’s not really what they are about.
They improve our speed of producing working code.
Micro-tests are small tests that test small code. But if you write them incrementally, you make a large piece of code faster. Which also works. You just don’t waste time on writing extra code that gets in your way of adding more code later. You don’t debug.
Think about it: Continuous work of adding code that works.
TDD focuses on adding just enough code – enough to work, and enough for us to focus on. We then move to the next bit. The smaller the bit, we move faster. We focus on the current small problem, solve it and move on to the next one.
We don’t debug, because that’s a big waste of our time. If we don’t understand what’s going on, we’re not in micro-land anymore. If we get stuck, we can (and should) revert. We haven’t written too much code since we were green anyway.
The smaller you cut your “feature”, with micro-tests, you’ll implement “all the features” – faster.