Unit Testing

Unit Testing

Unit Testing involves the testing of individual units and components of a system.

DO'sDONT's
  • Create unit tests for those parts of the code that have well defined consistent behaviour.

  • Write tests to reproduce bugs.Don’t go crazy now, only for those bugs that could make or break the application.

  • Test should be:
    • Isolated
    • Independent
    • Repeatable
    • Automatable
    • Self-Descriptive
  • Don’t test trivial things: Although a unit test applies testing strategies to units of code, a line must be drawn as to how small a unit worth testing should be. If these units are too small then a developer might have many unit tests but their value and use could be brought into question.

  • Don’t create unit tests for functionality that is still in the ‘trial and error’ phase: Unit Tests work better when they are ensuring that a module’s or method’s state is retained rather on those functionality have not yet been settled on.


Shantel Stewart