November 2024
Intermediate to advanced
300 pages
7h 12m
English
Many of your system’s behaviors will demand several distinct test cases. For example, you’ll often end up with at least three tests as you work through the progression of zero-one-many.
Defining separate test methods allows you to explicitly summarize their distinct behaviors in the test names:
| | storesEmptyStringWhenEmpty |
| | storesInputStringWhenContainingOneElement |
| | storesCommaSeparatedStringWhenContainingManyElements |
Often, the three test cases will be structured exactly the same—all the statements within it are the same, but the input and expected output data differ. You can streamline the redundancies across these tests with things like helper methods and @BeforeEach methods if it bothers ...
Read now
Unlock full access