Organizing your Workspace

How you organize your workspace to include unit test projects depends on how you plan to structure your unit tests.

If you plan to call into another program and test that source code, your unit test projects must be in the same workspace as the program you plan to test; or if you have a remote unit test project, the sources it tests must be located on the same remote host and accessed using the same connection as the unit test project. You can also create self-contained unit test projects, where the code under test is all stored within the unit test project, in which case, the project can be stored in any workspace/location.

If you are calling into another project from your unit test project, both projects must be compiled to the same bitism.

Also, the project under test can be compiled to a number of target types (Single Executable File, Single Native Library File, All Native Library Files, or All Int/Gnt Files), but if multiple projects are to be tested by one unit test project, those projects must not have a target type of Single Executable File or All Executable Files - Single Executable File can only be used when only one project is to be tested, and All Executable Files is not supported at all.

When working with multiple projects, from within the unit test project, create a test fixture for each project under test, so that when creating the fixture file using the Create unit test from program option, the necessary elements to link the test cases directly to the source code in that project are added.

An alternative approach to testing existing source code is to use the MFUPP preprocessor. You do not need to link into your existing source project or change any source code. You can isolate the source code to put under test by adding the source as a linked file to your unit testing project. When that project has MFUPP enabled, any code insertions or stubs can be coded in the unit test project, leaving the original source code project completely untouched. This type of approach is recommended if you are focussing on smaller parts of code as the preprocessor is able to test on a more granular level than a typical unit test; see MFUPP Preprocessor for more information.