TL;DR
It is a useful software testing practice to first use constraint oracles. Constraint oracles check if input, output, or internal variable value is in defined constraint. The post is aligned with the Black Box Software Testing Foundations course (BBST) designed by Rebecca Fiedler, Cem Kaner, and James Bach.
Constraint oracles checks for impossible variable values or impossible relationships between variables. Variable could be input, output, or internal.
Examples
Example for the input variable is uploaded image size when we have restriction on the image size of 10 Mb.
Constraint oracle applied to the output variable is when the result of the multiplication of ten integer variables could not be greater than five million.
Checking the impossible relationship between variables is when we have a user age variable and video content type for which that user subscribes. Minors could not subscribe to violent movies.
Advantages
The advantage of constraint oracles is that they could find straight coding errors. It is good practice that developers use constraint oracles as requirements for the features they develop.
Disadvantages
The disadvantages are that we could miss some complex values that do not obviously conflict with constraint. For example when we use emoji (zero-width character) in username. The system could allow names that look the same when displayed, which could lead to security implications.
Using constraint oracles is a good practice that could be used to reveal the developer’s code quality.