Sometimes code is not easily testable because it's non deterministic by design. That's got nothing to do with messy dependencies.
I think we can all agree tests are necessary and helpful but sometimes the fervour of the "everything must be unit tested" brigade makes me feel like they're either:
0. Fresh out of university and don't know any better.
High up enough in the management chain that they don't write code anymore and don't have to deal with the challenges of what they're asking for.
Seems like an appropriate place to ask “How can I adequately test Active Record type classes?”
Often the data stack I need to setup before I get to my test data is very, very, very time consuming, and painful (enterprise). The alternative is, er, hard-coding data through a mock class or similar, but then what’s the point?
If it’s something I’m going to be working with a lot I will put in effort to automate the entire data stack, but more often than not it’s something I’ll throw over the fence and never see again. And setting up all that data to test it correctly will take up 90% or more of the time. It often takes up most of the time just setting it up manually.
22
u/dododindon Jul 20 '18
Which proves that this "testing" fad is not reliable enough for real business.