On 03/03/2011 04:08 PM, Cédric Beust ♔ wrote:


On Thu, Mar 3, 2011 at 3:16 AM, Miroslav Pokorny <[email protected] <mailto:[email protected]>> wrote:

    Heres a crazy question, does the need for a mocking framework
imply that perhaps theres something wrong w/ your design ?

I wouldn't go that far. I'm not a big fan of mocks but when your application contains some logic that takes a while to produce results or to set up, mock ups can be a good way to make sure that you can have set of very fast running tests that can give you a quick thumbs up or thumbs down after you've made a change.

I think that using mocks as the default way of creating tests (something that is usually encouraged by TDD) is misguided. You should start by writing tests that actually test your functionality, even if these tests take long and they are hard to configure. Once you have such functional tests, you can consider introducing mocked unit tests to add some fast tests to your environment.



Hmm... in TDD you first have tests and then code. I don't see how you can do that without using mocks. At least at the principle (eventually, as the application grows and you add more production classes, you could replace mocks with them). In my experience, I start with all mocks, and as more tests are added some mocks start to be shaped enough to become production classes.

--
Fabrizio Giudici - Java Architect, Project Manager
Tidalwave s.a.s. - "We make Java work. Everywhere."
java.net/blog/fabriziogiudici - www.tidalwave.it/people
[email protected]

--
You received this message because you are subscribed to the Google Groups "The Java 
Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en.

Reply via email to