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 ... 27 28 29 30 31 32 33 34 35 ... 51  | » ]
James Tikalsky

Posts: 12
Nickname: jt2190
Registered: Dec, 2003

Re: A Set of Unit Testing Rules Posted: Sep 14, 2005 5:49 PM
Reply to this message Reply
If I recall correctly, the term "unit test" was borrowed from outside of computer programming, and refered to the testing of a single part or piece, removed from its whole. For example, instead of testing a whole engine at once, a single piston can be removed from the engine and placed in a testing device. This allows the testers to simulate things that would either rarely or never happen to the piston it in its lifetime, or would take years of real world use to determine, say how the piston wore over one year of use.

The key thing is that the part has been isolated. If there is a failure, there is no doubt about what, exactly, failed, or what the part was doing when it failed.

Your five rules can essentially be rolled into one: Isolate and test only one part.

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.

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