The Artima Developer Community
Sponsored Link

Weblogs Forum
A Set of Unit Testing Rules

50 replies on 51 pages. Most recent reply: Jan 21, 2011 2:19 AM by Steve Merrick

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 50 replies on 51 pages [ « | 1 ... 21 22 23 24 25 26 27 28 29 ... 51  | » ]
Kelly R. Denehy

Posts: 8
Nickname: kdenehy
Registered: Dec, 2003

Mod parent up +5 Insightful Posted: Sep 13, 2005 11:48 AM
Reply to this message Reply
Advertisement
Oops, wrong website. :)

It's amazing how little mention of mock objects there are in this discussion. People seem to think that the only reason to avoid hitting a real database is the performance of the test suite. Somebody mentioned avaiability of the database (or other resource) as another issue, which is an excellent point. But one of the best reasons to use mocks instead of the real thing is that it's much easier to simulate certain runtime behavior (i.e., exceptions) using mocks, and ensure that your method under test handles it correctly.

If you really think your existing unit tests are doing a good job while hitting a real database, run them through a code coverage tool like Clover, Cobertura, or EMMA. You'll probably see that little if any of your exception handling code is ever tested.

Flat View: This topic has 50 replies on 51 pages [ « | 21  22  23  24  25  26  27  28  29 | » ]
Topic: Computer About to Play Jeopardy Previous Topic   Next Topic Topic: The Search for Requirements

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use