3 ms·
I mean he's basically advocating to use your best judgement but I find far too often test that is too WET (Wantonly Expanded Test). Test that are DRY increases
by AzN1337c0d3r 5y ago
I mean he's basically advocating to use your best judgement but I find far too often test that is too WET (Wantonly Expanded Test).
Test that are DRY increases the confidence that the test tests the correct things by holding everything else constant.
When the tests break, no one wants to scroll through 500 lines of test code looking at every detail to find out what "variant" the test is and if the problem is in the test because of a fatfinger, or the problem is in the code being tested.
- pitched 5y agoIf you make a code change that breaks one test and think it might be a broken test, it’s easier to read that test if it’s not dry. Because all of the dependencies are listed out more explicitly. Dry tests use a lot of helper methods and those are a layer of indirection. To understand a dry test, you have to also understand the helper methods, and whatever helpers they all call. > Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
- AzN1337c0d3r 5y ago> Dry tests use a lot of helper methods and those are a layer of indirection. This is exactly my point, you reduce noise. > To understand a dry test, you have to also understand the helper methods, and whatever helpers they all call. To understand your TEST SUITE, you understand all the helpers exactly once with DRY tests.
- pitched 5y agoI think the debate is whether it should be tuned to make it more accessible to yourself (code owner) or others (code owners of nearby systems). And the best advice is where we started: > use your best judgement