|
|
|
|
|
by cultofthecow
1101 days ago
|
|
Such a bad take IMHO. Sorry. 1. You still need to update the fake object once you gonna add a new behaviour. 2. Fake object has a tendency to become logic heavy. Someone will add a stupid-not-needed-map to test some shit you don't need to test in this unit\layer. 3. You only need to mock the behaviour you depend on. If you've added new Method and you need to mock it despite the fact you're not using it in the code you're testing - its a bit weird and smelly. Consider rethink SOLID principles at least. 4. Go. Gen. Effectively you can automate mock generation. Debatable but it's cool. Just. Keep. Things. Simple. Depend on what you need. Mock behaviour you need. Try to test flattened structure - do not test the layer below the one you're testing ATM (unit tests). |
|
All that said, I personally prefer the upfront investment in stubs. At scale, it is something readily reusable by other test suites and teams out there.