Software testing is concerned with selection of test data to produce incorrect output or failures. When a program produces a failure for some test execution, one knows it contains at least one fault.
For failure to be observed the following three conditions must be met: 1) the defect is executed, 2) the program has transitioned into an infectious state, and 3) the infection has propagated to the output. Coincidental correctness arises when the program produces the correct output, while conditions 1) and 2) are met but not 3). It is a safety reducing factor for coverage-based fault localization.
Coincidental correctness is described as when a specific test point follows an incorrect path, and yet the output variables coincidentally are the same as if the test point were to follow the correct path”. Coincidental correctness occurs when a wrong function is executed, but due to some coincidence, the output is the same as if it were computed by the correct function.
Coincidental correctness occurs when no failure is detected even though a fault has been executed”.
Example: A program is to calculate y = x2.
It is incorrectly programmed as y = 2x, and it is tested with the input value x = 2.