|
|
|
|
|
by mxz3000
1919 days ago
|
|
The given, when, then breakdown is interesting, though I've never seen language test utilities actually enforce that structure. Maybe an interesting potential experiment (regardless of language) ? I feel like your last point is especially important. Sooooo many times have I seen over-abstracted unit tests that are unreadable and are impossible to reason about, because somebody decided that they needed to be concise (which they don't). I'd much rather tests be excessively verbose and obvious/straightforward than over abstracted. It also avoids gigantic test helper functions that have a million flags depending on small variations in desired test behaviour... |
|
Personally, I work with some incredibly (100+line) long "unit" tests and they are a nightmare to work with.
Especially when the logic is repeated across multiple tests, and it's incorrect (or needs to be changed).
I really, really like shorter tests with longer names, but I'd imagine there are definitely pathologies at either end.