CORREC[T]: [T]ime

The last boundary condition in the CORRECT acronym is time. You need to keep several aspects of time in mind:

  • Relative time (ordering in time)

  • Absolute time (elapsed and wall clock)

  • Concurrency issues

Some interfaces are inherently stateful. You expect login() to be called before logout(), open() before read(), read() before close(), and so on.

Consider what happens if methods are called out of order. Try various alternate sequences. Try skipping the first, last, and middle of a sequence. Just as order of data matters (see the examples in C[O]RRECT: [O]rdering), the order of the calling sequence of methods matters.

Relative time might also include issues of timeouts. You must decide how long your code will wait for an ...

Get Pragmatic Unit Testing in Java 8 with JUnit now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.