8 Nov 2004

Does it smell ?!

Excellent set of blog about:

Test suite smell:
Suite takes too long to run
(...) These tests are more often than not integration/system tests (...)
When I first started to use JUnit, I did it to help me get a piece of code work. This set of classes where too complicated, unforunatly I couldn't isolate this from the rest of the system and my tests became integration tests that took too long and do not even cover 10% of the tests.
Since then I've learn from my mistakes and I've mocked up some parts to get holy isolation.

But mock aren't always the answer...
Over reliance on mock testing
(...) the usage of mock/stub to stand in for real implementations is that the standins do perform in a fashion largely identical to the real thing. If this is not the case (...) then reality will tend to remind you of this mistmatch (...)
Exemple: A classe need a file, but you can't rely on the file to be in the file system when you run the test, then you mock it up.
The MockInputStream need to behave like a normal InputStream otherwise your test can get a green bar and never work with a real file...

No comments: