Timeline for Brittle unit tests due to need for excessive mocking
Current License: CC BY-SA 3.0
4 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Mar 9, 2013 at 17:41 | comment | added | PremiumTier | Yeah :( That would be that poorly-designed legacy code I was referring to. We are working on the re-design and refactor but we felt it would be best to put the source under test first. | |
| Mar 9, 2013 at 11:14 | comment | added | Joppe | Looking at the method names I think your tested class is simply taking on too many responsibilities. Read up on single responsibility principle. Borrowing from MVC may help a bit, your class seems to handle both UI, infrastructure and business concerns. | |
| Mar 9, 2013 at 0:17 | comment | added | PremiumTier | The problem is we have to mock the 'how' to test the 'what'. It is a limitation imposed by the code's design. I certainly have no wish to 'mock' the how as that is what makes the test brittle. | |
| Mar 8, 2013 at 23:15 | history | answered | Joppe | CC BY-SA 3.0 |