Unit testing – why? Part 2: What did I just break?

Ok, so I had to modify an existing class for a new feature. Does everything else still work ok?

If I have unit tests in place I can fix a lot of bugs without deploying, not just bugs in my new method but bugs in existing methods. If old code relies on a piece of code and it changes, this can break the old code. The worst example of this is fixing existing code when other code relied on it not working properly.

Having unit tests in place helps a developer see side effects of modifying existing code without the need to build, deploy and test.

Leave a comment