Are unit tests worth it?


In the realm of software, unit tests are like unsung heroes. They quietly play a crucial role, ensuring that each part of the code, or each “atomic unit,” behaves as it should. 

Let’s dive a bit deeper into this concept, keeping things simple and relatable. Imagine we’re talking about a car.

Unit Tests: Checking the Basics

Consider a car. It’s made up of various parts, each with a specific function. In unit tests, we focus on these individual parts separately. We’re not concerned with how they interact, but rather, we want to make sure each part is doing its job correctly.

For instance, we might have two separate unit tests for a car:

  • One that checks if the engine is working properly.
  • Another that ensures the window fits perfectly in the door.

Integration Tests: The Interaction Game

Moving on to integration tests, this is where we see how well the different parts play together.

Sticking with our car analogy, an integration test might check whether you can smoothly open the window while the engine is running

It’s like making sure the various components of the car cooperate well, ensuring a smooth ride (or in our case, smooth code execution).

Upgrades and Adjustments: The Test Continues

Imagine wanting to upgrade the engine of the car. Naturally, this change means that new unit tests will be necessary to ensure the revamped engine’s behavior is up to mark. 

However, the unit tests for the window remain unchanged; they continue to ensure that the window fits and operates as it should.

When Tests Fail: Unveiling Issues
If an integration test fails, it’s a clear red flag—something’s off. It’s pretty straightforward. 

But let’s consider a scenario where a unit test, say for the window, crashes unexpectedly. 

This could signal a significant issue, possibly pointing towards a problem like tight coupling in the code.

The analogy might seem a bit abstract when applied to a car, but in the software world, weird and unexpected things happen quite frequently. Understanding unit and integration tests, and their significance, helps in navigating through the complexities and weirdness that software development often presents.


To keep certain standards of the software, we need to implement all layers of the test pyramid.

Join The Android Architect cohort #2

6 weeks cohort course on Architecture and Mobile Devops

✅ Mentor + peer homework review

Learn from Kotlin GDE, Jarosław Michalik: Draw on the expertise of a seasoned Android professional.

high-level design guide for Android Architects

Wow finally something straightforward” ~ Marcin, Senior Android Engineer

  • high-level design overview
  • explanatory video
  • you were probably looking for it for a long time

Read more:

  • #kotlinDevChallenge 2023 summary

    #kotlinDevChallenge 2023 summary

    The KotlinDevChallenge was not just a competition, but a journey of learning, growth, and community engagement. Every participant in this challenge is a winner…

  • #kotlinDevChallenge – 24

    #kotlinDevChallenge – 24

    What do you love most about Kotlin? Productivity increase? Idioms? Or that it isn’t Java? Maybe something else! Share it. It can be short.…

  • #kotlinDevChallenge – 23

    #kotlinDevChallenge – 23

    Challenge checking your generics knowledge 🙂 No long description is necessary. You can select more than one answer. Good luck!