In the previous section, we looked at the rather mundane issue of file layout and naming conventions. We are now going to take a look at the ways we can improve the test cases themselves.
Our first goal is to make it easier to understand the tests themselves. There is nothing worse than locating a test case and then having a hard time figuring out what the test is trying to do.
I'm sure I will not be the first to confess that there have been multiple occasions where I have returned to a test that I myself wrote a year back, and struggled to understand what I was trying to do.
This is an area that is often ignored because when we write the test, it seems perfectly obvious what the test does. We will need to put ourselves in the shoes of someone who is looking at the test for the first time or after a couple of years and trying to understand the test without having the contextual knowledge that we had while writing the test. This is a recurring problem when working on large...