4 ms·
> but too much DRY in tests can make for hard-to-modify spaghetti This applies to all code, not just tests. Dry can turn some stupidly simple if somewhat repe
by flukus 9y ago
> but too much DRY in tests can make for hard-to-modify spaghetti
This applies to all code, not just tests. Dry can turn some stupidly simple if somewhat repetitive code into a complicated mess.
For unit tests though, as I general rule I don't share any setup between tests but I use the test fixture setup method for common mocks to return default answers. Even that can get too hairy at times and it's better off creating a second test fixture.