Decide Where to Put Test Code

This might seem a strange heading, but what we need to consider is whether the nature of the development warrants a dedicated test harness program or whether a bolt-on module to the application itself would be suitable. Let’s examine this further.

A major component—for example, a remote ActiveX server—has clearly defined public interfaces. We want to test that these interfaces all work correctly and that the expected results are obtained, and we also need to be sure that the appropriate error conditions are raised. Under these circumstances, it would be most suitable to write an application that links up to the remote server and systematically tests each interface. However, if a small GUI-based application were being created that was entirely self-contained (no other components were being developed and used at the same time for the same deliverable), it might be more appropriate to write the test code as part of the application but to have visible interfaces (for example, a menu item) only visible if a specific build flag is declared.