Writing Data-Driven Tests
Good tests are FAIR—fast, automated, independent, and repeatable. If tests aren’t independent of each other, then they have to run in a specific order. And by adding or removing a test, we may break the order and the tests may fail. Such tests will become expensive and hard to maintain.
One way to guarantee independence of tests is to never place multiple asserts in the same test for verifications that are independent of each other. The obvious benefit of this approach is that tests can evolve without affecting and without being affected by existing tests. The downside, though, is that we end up with too many tests—verbose, hard to understand, and tiring to write.
KotlinTest provides data-driven tests to solve this ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access