Why write unit tests? As developers, we want to write code that works and has as few bugs as possible. For example, when we write some production code we expect that given an input of abc the application will respond with 123. Writing and running automated tests can give developers a high level of confidence that their code does what it’s supposed to do. Unit tests isolate the system under test and throw a variety of scenarios in the system’s direction.