D E V M A T E

Loading

Illustration checklist

In this post, I present a checklist that you can use to assess the quality of your unit tests (regardless of the used language or unit testing framework).
The checklist is thereby divided into three parts. The Test Suite checklist contains questions that have to be answered once for the whole test suite that is assessed. The Test Class checklist contains questions that have to be answered once for each Test Class of your assessed Test Suite. The Test Case checklist contains questions that have to be answered once for each Test Case of your assessed Test Suite.

By comparing the answer to each question to the expected answer, you get a feeling for the quality of your unit tests, as well as open tasks to improve quality (towards the goal of correctly answering all questions for your testing project).
You can even quantify and compare quality to other projects, by adding up all of your negatively answered questions for a test project (eventually dividing it by the number of test cases).

Unit Testing Quality Checklist

Test Suite Checklist (answered for the whole Test Suite)

  • Did I consistently use a Pattern for my Test Code?
    Answer must be yes.
  • Did I consistently use a Pattern for naming my test cases?
    Answer must be yes.
  • Did I really stick to the used Test Pattern (double-check!)?
    Answer must be yes.

Test Class Checklist (Answered for each Test Class individually)

  • Do I understand the content of the Class based on its name?
    Answer must be yes.
  • Can someone else describe the content of the Class based on its name?
    Answer must be yes.
  • Does every Test Case comply to this purpose?
    Answer must be yes.
  • Can someone else verify for each test case that it correctly belongs to the current class?
    Answer must be yes.

Test Case Checklist (Answered for each Test Case individually)

  • Do I understand the content of the test based on its name?
    Answer must be yes.
  • Can someone else describe the content of the test based on its name?
    Answer must be yes.
  • Will I understand the test case (compare checkpoints above) in 6 months from now?
    Answer must be yes.
  • Do I immediately know in which line of code to change the value of a used variable at a given line of code (without adding another line of code)?
  • Can a junior developer change the value of a used variable at a given line of code (without any help, and without adding another line of code)?
  • Do I immediately know in which line of code to change an assertion, if the expected result changes?
  • Does a junior developer understand in which line of code to change an assertion (without any help)?
  • Do I immediately undertstand the syntax of the call to the tested code unit?
  • Does a junior developer understand the syntax of the call to the tested code unit (without any help)?
  • Do 10 executions of this test case yield the same result 10 times?
    Must be yes.
  • What is the number of covered use cases?
    Must be exactly 1.
  • What are potential sources (code units of the tested system) for a Unit Test to fail?
    Must be exactly 1.

What do you think about this checklist?
Did you already try it out in your unit test projects?
Do you have suggestions for improvement?

Let me know in the comments section below.

 
written by Daniel Lehner

Leave a Comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Want to experience the magic of devmate?
Join A Live Product Demo
Get Free Access Now to
9 eBooks!
All about Automated Software Testing
Proven experts
Learn to save up to 75% of your test efforts
Get Free Access Now!
Get Access Now! & Save 50%
Personal Trainer FREE Nutrition Custom Workout App
Get Access Now!
eBook Download
Enter your details to get your free ebook!
All about Automated Software Testing
Download Free Ebook
SUBSCRIBE
MY WEB
NEWSLETTERS
Lorem ipsum dolor sit amet, consectetur adipiscing