Test Review Guidelines

 

A more elaborate and always up-to-date version of these guidelines can be found at http://www.artofunittesting.com/Test_Review_Guidelines

Reviewing General Tests

  • Make sure the test does not contain logic or dynamic values 178
  • Make sure the test tests one thing only 179
  • Make sure that unit tests are separated from integration tests 180
  • Check coverage by playing with values 180
  • Make sure that testing private or protected methods is not the norm (public is always better) 182
  • Make sure there is little to no duplication of code in the tests 184
  • Make sure setup and teardown methods are not abused 188, 214
  • Make sure tests are completely isolated and repeatable 191
  • Make sure that most tests only have one assert 198
  • Make sure tests are not over-specified 205
  • Check for good naming conventions 210-211
  • Make sure that only meaningful assert messages are used 212
  • Make sure asserts are separated from actions 214

Reviewing Mocks and Stubs

  • Make sure that state-based testing is preferred and used over interaction testing 83
  • Make sure strict mocks are used as little as possible 106
  • Make sure there is only one mock per test 94
  • Make sure the test calls ���Verify��� or assert on one mock and not on all fake objects in the test (or it might be testing more than one thing) 123
  • Make sure that only in rare cases a stub is also a mock at the same time in the same test 84