As we know, the general structure of a test case is composed of four stages: setup, exercise, verify, and tear down. The actual test happens during the second and third stage, when the test logic interacts with the system under test, getting some kind of outcome from it. This outcome is compared with the expected result in the verify stage. In this stage, we find what we call assertions. In this section, we take a closer look at them.
An assertion (also known as a predicate) is a boolean statement typically used to reason about software correctness. From a technical point of view, an assertion is composed of three parts (see the image after the list):
- First, we find the expected value, which comes from what we call test oracles. A test oracle is a reliable source of expected outputs, for example, the system specification.
- Second, we find the real outcome, which comes...