Unit Testing

I’m someone that writes unit tests. I don’t understand why people don’t like them.

When i see others struggling to get their code running, I often see them going through the same time consuming motions of:

  • Starting the app
  • logging in
  • Waiting for menu to load
  • Click several items

This will cost then minutes of precious time that could have been used elsewhere. I just hit [CTRL]+[R],[CTRL]+[A] (all test) or [CTRL]+[R],[CTRL]+[T] (current unit test).

 

 

Assertions

I’ve written lots and lots of code. I’ve written code with lot’s of people. I know I won’t remember it all. When I write code I know that certain conditions will fail my code,.. or when this code ran, the state should be xyz.

I use the Debug.Assert(…) to anchor such logic, and when it fails, I can immediately see what has gone wrong.

Debug.Asserts are a tool that I use to write defensive code.