3 ms·
It makes tests self-contained and easier to reason about. As a side-effect, random tests won’t accidentally break whenever you change some seemingly unrelated c
by Zanfa 3y ago
It makes tests self-contained and easier to reason about. As a side-effect, random tests won’t accidentally break whenever you change some seemingly unrelated csv file.
As a rule of thumb, I also only assert on input/output values that are explicitly defined as part of the test body. Saves a ton of time chasing down fixture definitions.
- jononor 3y agoDon't make the files "seemingly unrelated". Have a very clear relationship between test data and the tests. And keep the mapping simple, ideally 1-1 data file to test. Or 1 file to 1 group of tests. Of course it depends on the amount of data. If < 50 lines, inlining is practical.