2.4. Reading a test dataset from an external source
One of the challenges I face when creating a new unit test (especially in test-driven development, as the test is created before the implementation code) is finding correct test input. For basic unit tests in which only a single class is tested, you might get away with trivial data created on the spot.
For integration tests, however, which test multiple code modules, your selection of test data needs more thought. Once you have enough tests for the happy paths of your code, it’s time to examine all corner cases and strange scenarios. Creating effective test data is a separate skill of its own, but a good source of such data can be found on an existing running system. Often, test data can also ...
Get Java Testing with Spock now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.