On 2013-06-20 00:13, Paulo Pinto wrote:
The issue is not to test third party libraries, far from it.
The problem is that you cannot mock them, specially if you rely a lot on
non virtual methods or pure function calls. Or on framework code that
calls your code back, after certain events happened in the system.
I would only mock an external service that needs to be available online.
I don't mock third party code. That would be insane. There's no limit.
Should I mock the standard library?
To do that properly, you end up wrapping third party code into code that
can be replaced for unit tests execution, thus making the test effort an
herculean task.
I have only had a few cases where I needed to mock. I have only done
that in our Ruby on Rails project. I guess that's quite a lot easier
since you can very easy replace any method at runtime.
--
/Jacob Carlborg