This is a living document, it will be updated from time to time as my test writing evolves.
It's easy to fall into the trap of writing your tests with less care than you would your regular code. After all, if tests pass, then ship it is de rigeur, so there's an incentive — especially if the clock is ticking closer to the end of workday — to get those tests passing ASAP.
One corner that is often cut is to introduce or reuse variables between tests. For example:
- I am writing tests for updating a user's profile. I will create one user and run all tests against that single user.