- Automatically generate unit tests; this will give you a template.
- Keep one of the generated tests as a template, preferably one that passes (does not throw an exception) when run.
- Using the one test as a template, replace test object allocations by declaration with those on the heap (using new).
- At the end of the test, if a parent object is used, delete only that—whether it is the primary test object or a secondary test object.
- Validate the one test by using a debugger to observe the final test object states and inserting appropriate assertion macros.
- Add more test cases (using the GUI dialog option, and using the first validated test case as the template).