A Test of Knowledge

347

Software testing is a form of learning. A set of tests can be considered a set of questions. The most obvious question a unit test poses is “Does the code pass?” to which there are two simple answers: yes or no. A test allows us to move from belief to knowledge — for example, to move from merely believing something works to knowing that, in a particular case, it does or does not. Even limiting the scope of testing to just this question and these two answers reveals more than a binary set of possible outcomes:

  • It passes, which is what we expected.
  • It passes and we are surprised, as this is not what we expected.
  • It fails, which is what we expected.
  • It fails and we are surprised and disappointed, as this is not what we had hoped or expected.

Read more at Medium