There are unit tests, integration tests, API tests, end-to-end tests and other “test” animals. (No animal was tested for this post). But micro-tests?

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.

Check out the following workshops where I talk about unit tests and micro-tests:

Categories: Uncategorized


William Hruska · August 19, 2020 at 2:39 pm

Are you trying to say micro tests and unit tests are the same?? I am a little confused.

    Gil Zilberfeld · August 20, 2020 at 5:59 pm

    Yes, it’s a bit confusing, because we’ve got a lot of boxes and labels. But it depends on how you think about unit tests. “unit” is about WHAT you are testing – a method, or a class. A small piece of code. So in that way “micro” may equal unit.
    But… if you’re thinking from the perspective of programming flow, when every test moves you closer to the goal, and you move in small incremental steps, that’s where the micro test definition really shines. Because at the end of the day, you don’t think “man, that class is really well tested”. You think, “man, that feature works.” And the best way to get there is by small incremental tests.

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *