Every program module that we write is paired with and preceded by several unit tests. To be explicit, unit tests are aligned to the code not to the features.
Our unit tests cover every program module in the code with both a positive and a negative test. Ideally our unit tests also cover every line of code, but that can be impractical. Ideally there are enough tests that removing any line of code causes a test to fail.
Positive and Negative test
Every program module has unit tests that checks that it works properly with expected input as well as unit tests that check that its handles incorrect inputs appropriately.
Appropriate Handling of Incorrect Inputs
- Log a warning if it makes sense to re-try, or an error otherwise.
- Throw an exception
We do not return error codes, nor check return codes to see if a program module has failed. When we interface with third-party software that do return codes for errors, we wrap those calls in procedures that perform the checks and throw exceptions as appropriate.
Unit tests will be written in an xUnit testing framework. We use Junit for Java, tsqlt for SQL Server, and utPLSQL for PL/SQL.
Each product has a regression test suite, which calls a regression test suite for each module, which references the individual tests.