Unit testing to cleaner code

Kristijan
3 min readNov 17, 2022

Introduction

Everyone will agree, software testing has an important place in software development. But why is that? The usual answer is that it helps us maintain the correctness of our software. That may be to test new code works as intended, but also that our new change didn’t cause a mistake somewhere in the previously existing code. However, that is not all. One often overlooked benefit is that it can help us write cleaner code, and in the rest of this article, you can read my thoughts on how unit tests help us do just that.

Types of testing

There are quite a few different types of testing. And when talking about testing, it is important to know which type we are talking about. Some types are:

· Unit testing — this type tests the smallest possible part of code independent of other areas. You give the required input and test what is the output based on that

· Integration testing — a type of testing where you take multiple different and connected parts of code and test how those work together

· End-to-end — this is the type where you would test the whole application with all its…

--

--