Member-only story

More than testing — writing unit tests for better design

Use unit tests to inform the design of code

Kislay Verma
8 min readSep 6, 2020

This article was originally published on my website — https://kislayverma.com/programming/more-than-testing-writing-unit-tests-for-better-design/

If you like to read about software craftsmanship and fun programming stuff, sign up for my mailing list and weekly newslettter. I send a round up for weekly writing and the best technical reads I find on the internet from a week’s worth of trawling.

For the first nearly ten years of my programming career, I hardly wrote any unit tests. I wrote a lot of code, and tested almost all of it by running it and testing for end-to-end behaviour, mostly manually. However , as I started inheriting larger and larger codebases and projects across multiple teams in my role as an architect, I began to see why everyone went on about unit testing. There usually isn’t a faster way to know that the code you are writing is safe and works as expected. This is a huge safety net during refactoring complicated code. It is certainly cheaper than having to start a service with its datastore and other attending paraphernalia just to see if a small change is fine. Good unit test coverage also serves as a good and fast way of ensuring that you are shipping the right thing in the land of CI-CD etc. Running integration tests which require elaborate set-up if you want to deploy very often can be very expensive on the infra.

--

--

Kislay Verma
Kislay Verma

Written by Kislay Verma

Code, products, platforms, books, music

No responses yet