With unit testing, how extensive should mocking be?

I’ve got a colleague who was brought in as a testing specialist to help improve code quality and reduce bugs. I’ve done a little testing before, but am no means an expert.

When they joined I was really excited to learn from them as testing is definitely an area I lack experience.

He’s got good coverage and he writes tests for literally everything he does, but it’s something like 95% mocks as opposed to what I would call “black box” testing; testing the input and output. Does that sound reasonable?

As I say, I’m not an expert, but his testing strategy doesn’t seem particularly effective and it puts constraints over exactly how code is implemented rather than testing that things behave correctly.

submitted by /u/IAlwaysFeelFlat
[link] [comments]