In software engineering, the correctness of a program or system is achieved if it behaves exactly as intended for all of its use-cases.
Before software is developed, engineers craft a list of specifications that their system must adhere to in order to achieve correctness. Without achieving correctness, a system is not ready for use, as it might be unsafe or incomplete.
We can establish correctness via rigorous software verification and testing. The brute-force method would be to test the system with a wide range of inputs and detect erroneous output if any exists.
Alternatively, we can prove correctness via mathematical reasoning or proof. Unfortunately, it is hard to automate the process of establishing correctness.
One way to prove program correctness is to determine the control flow path(s) that a program takes while executing via path coverage.
The program must traverse through a certain control flow path to achieve correctness. If the path taken by the program is identical to the correct path, we can deduce that the program has performed the corresponding task correctly.
In integration testing, different system components are combined together into a single unit, and correctness tests are performed on this collective unit. This is a relatively traditional method of software testing, as in more recent, agile methods, testing is performed at each stage of the software development life-cycle.
To make the process of establishing correctness easier, it is recommended to observe the following best practices:
Free Resources