Mistake: treating setup or cleanup as the test itself. A test script executes the code module with specified inputs; pretest scripts prepare data, while posttest scripts remove it. section 7.5
A practical unit test separates its responsibilities:
- Use the pretest script to populate required tables or otherwise prepare the environment. section 7.5
- Use the test script to invoke the code module with values such as CampaignID 27587, Budget 10, and Detailed 1. section 7.5
- Use the posttest script to delete created data, such as a sales order, after execution. section 7.5
Checking results
A test can verify scalar values—1.7876, 195, and 6.85—and require 42 rows in a second result set. Remove the default inconclusive condition before adding these checks. section 7.5
Figure 7.6 Creating a unit test
Use the unit-test editor to select the test script and configure its result conditions. section 7.5

