Category: Writing Larger Tests
-
Testing larger components
As always, let’s use a concrete example. Suppose we have the following requirement: Given a shopping cart with items, quantities, and respective unit prices, the final price of the cart is calculated as follows: NOTE The business rule related to delivery costs is not realistic. As a developer, when you notice such inconsistencies, you should talk…
-
When to use larger tests
I see two situations where you should use a larger test: The following sections show examples of both cases and will help you generalize them.
-
Introduction
Most of the code we tested could be tested via unit tests. When that was not possible because, say, the class depended on something else, we used stubs and mocks to replace the dependency, and we still wrote a unit test. As I said when we discussed the testing pyramid. I favor unit tests as…