Re:Zen and the Art of Unit Testing
by beaconstudios on Wednesday March 15, 2017 @02:27PM
(#13878498)
Testing that function would be a matter of mocking out the database with a class that can emulate the type of failure that would trigger your exception.
[ Parent
| on HN ]
Ooooh, yes. Testing error-handling code is another thing I keep on forgetting to do.
Re:Zen and the Art of Unit Testing
by beaconstudios on Thursday March 16, 2017 @05:52AM
(#13883762)
it's almost more worthwhile than testing your happy path - when things go wrong you want to have guarantees that they'll be handled correctly and not kill your server.