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 ... 29 30 31 32 33 34 35 36 37 ... 51  | » ]
Matt Gerrans

Posts: 1153
Nickname: matt
Registered: Feb, 2002

Re: A Set of Unit Testing Rules Posted: Sep 14, 2005 8:48 PM
Reply to this message Reply
> But in software, we have a wrinkle to contend with:
> What, exactly, is "one part"? Some say it's a single
> method, however, I've seen methods that were pages long.
> This brings us to the concept of Test Driven Design;
> refactor that big method into many small methods that
> each do only one thing, and they become easier to test.

What if you are coding outside the ivory tower? Suppose you are working at Microsoft and your assignment is to fix a bug in CreateFile() (, whose declaration looks like this:
HANDLE CreateFile(
LPCTSTR lpFileName,
DWORD dwDesiredAccess,
DWORD dwShareMode,
DWORD dwCreationDisposition,
DWORD dwFlagsAndAttributes,
HANDLE hTemplateFile

First, you'd probably like to write some unit tests (well, I guess that would be impossible, since any test of this function would not be a "unit test" by the definition proposed here), to make sure you don't break the existing behavior.

Refactoring to a lot of little functions is not an option here -- that would break thousands and thousands of applications.

Flat View: This topic has 50 replies on 51 pages [ « | 29  30  31  32  33  34  35  36  37 | » ]
Topic: Computer About to Play Jeopardy Previous Topic   Next Topic Topic: The Search for Requirements

Sponsored Links


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