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 ... 24 25 26 27 28 29 30 31 32 ... 51  | » ]
Steve Garcia

Posts: 1
Nickname: garcia
Registered: Sep, 2005

Re: A Set of Unit Testing Rules Posted: Sep 13, 2005 2:47 PM
Reply to this message Reply
Advertisement
>> Abstraction is great, we use interfaces all the time. But at some point, you just have to implement (and test) your RegistryStorage and FileStorage classes (two implementations of the IStorage interface). To test these, you'll *have* to touch the filesystem and the registry (which is actually a db). <<

Yes, I agree with this notion. I believe that every line of production code must be backed by a test, whether that is a unit test, an acceptance test, end-to-end test, system test, or whatever you call it.

However, there can conceivably be one class that writes to the file system. That class can be used over and over within the production code. And there should be a test around that class. But for the 50 classes that depend on that class, it can be mocked out with an in-memory version of that class.

Flat View: This topic has 50 replies on 51 pages [ « | 24  25  26  27  28  29  30  31  32 | » ]
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