Programmers The tables that use this fixture code are given in Chapter 16. In Chapter 16, we showed that many similar action tests may being used to test several business rules, including rules that are better handled as calculation tests. We now show two ways that Emily and Neo implemented the fixtures for those calculation tests. One approach is to have a fixture that calls directly into the specific logic that handles that business rule. This approach is good when the business rule is encoded as a distinct piece of logic, ideally as a function that can be called directly. The other, indirect, approach is similar to the approach Emily used in Chapter 32, when there was no API that she could test through. There she tested through operations on the GUI. In this approach here, the fixture calls a sequence of actions, creating sufficient objects to make it work. |