“Unit tests just saved my ass!”
I recently attended the Twin Cities Code Camp this weekend and sat in on a session by Jason Bock on how to write better code. It was an amazing session with tons of valuable information. One of the topics he covered was unit tests and he told a funny little anecdote about a co-worker of his who had an epiphany on unit tests. It went along the lines of this co-worker not being a fan of unit tests until he started writing them and had a test fail and discover a crucial error in his code.
That just happened to me! We’re writing a new billing platform at work and unit testing in this department has been somewhat of a low-priority. With this revamp, we’re taking the time to write unit tests on ALL of our classes, make sure they pass and have as much code-coverage as possible.
Now, until I started in this department (which is less than 6 months ago), I’d never heard of unit testing. In fact, the unit test that failed on me was the first real unit test I’d written, and, like Jason’s co-worker, it uncovered a rather crucial error in my code and forced me to make some changes so the test would pass. I now feel comfortable that at least that portion of my code works.
Unit tests indeed saved my ass today!
-
Recent
-
Links