Cedric Beust
Posts: 140
Nickname: cbeust
Registered: Feb, 2004
|
|
Re: Next-Generation Testing with TestNG
|
Posted: Sep 1, 2006 9:25 AM
|
|
Thanks for the comments.
Yes, a few things didn't come the way I thought they would, sorry about that. Here are a few clarifications.
Unit tests are important but I don't care about the arbitrary limitations that some people claim, such as "never access the network" or "never use files".
Do whatever it takes to make sure your class works as expected, and most of the time, the running time won't suffer much and you'll get rapid feedback if something fails instead of having to rely on acceptance tests higher up the stack. Unless you want to run your tests every time you save a file, these times will not add up to enough to make a difference.
As for mocks, they come at a price (designing a parallel hierarchy with its own semantics and maintaining it) and I've seen enough abuse of them that I strongly caution against them now. In my opinion, there is only one good reason to use a mock: when the object under test is hard or costly to materialize in a testing environment.
|
|