A dependent test relies on state or results produced by another test. Dependencies can arise when a test suite performs expensive setup once, rather than repeating it before every test. section 11.4.1
Shopping cart and sales statistics
Suppose one test checks successful purchases and creates orders in a database. A later test checks sales statistics using those orders. If the purchase test changes the orders it creates, the statistics test may need to change too. section 11.4.1
Sharing setup can speed up execution, but dependencies make tests harder to maintain. One failure can also trigger failures in dependent tests, making it harder to identify which failures have their own causes. section 11.4.1
Figure 11.15. With ordered, dependent tests, we can perform a common setup just once in the beginning of the test suite. However, each test case may have assumptions about the side effects of earlier tests.
The diagram shows ordered tests sharing one setup and relying on earlier tests’ side effects. section 11.4.1
