2 ms·
As always, there's a tradeoff. I used to go for doing all setup in each test for clarity, but one of my co-workers eventually convinced me that doing this in a
by disgruntledphd2 11mo ago
As always, there's a tradeoff. I used to go for doing all setup in each test for clarity, but one of my co-workers eventually convinced me that doing this in a fixture is better.
There'll always be some duplication, but too much makes it harder to see the important stuff in a test.
- bluGill 11mo agoIt depends on how much setup is done, and where it is. 10 tests that share a setup fixture are good. 100,000 starts to get unmaintainable. I have lots of test fixtures each responsible for about 10 tests. It is very common to have 10-20 tests that share a startup configuration and then adjust it in various ways.
- ozim 11mo agoI guess one level of inheritance is bearable, downside is once you start, there will be people coming in later adding more.