Free Newsletters
Technology & Business Daily

InfoWorld
Log-in | Register
STRATEGIC DEVELOPER  

The art and science of software testing

Test-driven development tools like Agitator help you validate before you write

By Jon Udell  
January 23, 2004
 

The Greek roots of the word “technology” suggest the translation “systematic treatment of an art or craft.” Dictionaries define the English word as “practical application of knowledge” or “manner of accomplishing a task.” TDD (test-driven development), as it has been popularized recently, is a technology that harkens back to those original meanings.

Free IT resource

Hear how top CIOs turn change into a competitive advantage.

Sponsored by HP

Free IT resource

Attend the SOA Executive Forum: Breaking SOA Bottlenecks SOAExecForum.com/may2007

Sponsored by InfoWorld

TDD’s premise is simple but radical: Write tests that validate the behavior of a module before writing the module. Tests create a safety net so programmers can “refactor with confidence.” As the pace of outsourcing quickens, they become part of the glue that holds a distributed project together.

The activity of test writing can also subtly transform the craft of programming. Some find it not merely a chore, but rather a useful way to explore a problem domain, one that’s complementary to spec-writing, in ways congenial to people who think better in code than in prose. Others cherish the psychological lift they get from TDD. Software project milestones are few and far between and there’s rarely much positive reinforcement along the way. TDD aficionados report that the green bars displayed when their tests pass are powerful motivators.

TDD does require a lot of time and effort, which means something’s got to give. One Java developer, Sue Spielman, sent a Dear John letter to her debugger by way of her Weblog. “It seems over the last year or two we are spending less and less time with each other,” she wrote. “How should I tell you this? My time is now spent with my test cases.”

Clearly that’s a better use of time, but when up to half of the output of a full-blown TDD-style project can be test code, we’re going to want to find ways to automate and streamline the effort. Agitar Software’s forthcoming Java analyzer, Agitator, which was demonstrated to me recently and is due out this quarter, takes on that challenge. The Agitator starts by exercising a class and making observations — for example, that the size of an array increased by one after a method call. After 100 trips through the code, it might report that the array grew 97 times, and didn’t grow three times. The 3 percent case doesn’t necessarily signify a bug. But a developer who determines that it does can convert the observation that the array didn’t grow into the assertion that it should. Thus, a new test is born.

Let’s suppose the method should grow the array. Passing along a wrong value from its caller is one way it could fail. So as the Agitator repeatedly exercises the method; it tries different combinations of input values, just as a human test-writer would do. But as Director of Product Development Kent Mitchell points out, constructing the objects that drive tests can be nontrivial. “I may know that I can call your Employee class and ask if the person is an active employee,” he says, “but I may not know how to construct an Employee that is active because, through the wonders of OO [object-oriented] design, I haven’t had to know that until now.” To write the test, then, a developer has to unpack a lot of carefully packaged abstractions. Agitar’s unarguably good idea is that we let the computer do that for us. TDD, of course, has always been about writing down assumptions so they can be mechanically checked. Think of Agitator as a power tool for that kind of writing.





 


 
Jon Udell is lead analyst and blogger in chief at the InfoWorld Test Center.

  More of Jon Udell's column
  Jon Udell's Weblog

Newsletter Check out all of our free newsletters!
Enter e-mail address:




 

TOP NEWS:


»  Troubleshooting tool for Java offered
Sun's Java VisualVM open-source technology views apps while they run on a JVM and is billed as all-in-one solution

»  Python backing eyed for NetBeans
Scripting language capabilities of the open-source IDE continue to expand

»  Microsoft sets Windows XP SP3 automatic download for Thursday
The latest service pack for Windows XP will be pushed to Automatic Update at 7a.m. EDT on July 10

»  Real Software, Veryant bolster dev tools
RealBasic, Cobol apps platforms get improvements

»  Microsoft sets hosted-services pricing, irks partners
By offering 38 percent discount to customers who buy entire hosted business productivity suite, Microsoft undercuts partners selling similar services

»  Adobe readying new mashup tool for business users
Mashup interface code-named 'Genesis' will open up desktop 'workspace' combining business application data, documents, analytics, and instant messaging




Beyond AntiVirus: Symantec Endpoint Protection
Today's threats to the endpoint are much more dangerous as they rapidly evolve to evade traditional security measures. To combat these threats, companies should supplement existing security with proactive behavioral based technologies. Join this webcast to learn about Symantec's next generation AntiVirus solution that provides that level of protection. Sponsor: Symantec

»  Click here to view this Webcast
  The Silver Lining: Cloud Computing
This IT Strategy Guide digs deep into cloud computing helping put you ahead of the curve on this hot topic. It explores the differences between cloud computing, grid computing and utility computing and then helps you see where and how each applies to your business. Sponsored by Box.net

»  Click here to download now

- Special Advertising Partners -
WHITE PAPERS
 

» Technology White Papers Library

Technology White Papers by Topic

Technology White Papers E-mail Alert

Find out when the latest white paper is available:
 
 
INFOWORLD MARKETPLACE
 
» BUY A LINK NOW
 

FIND PRODUCTS AND COMPANIES
» COMPLETE PRODUCT GUIDE



TECHNOLOGY INDEX
• Applications
• Application Development
• Security
• Networking
• Wireless
• Platforms
• Hardware
• Data Management
• Storage
• Web Services
• Business
• Telecom
• Professional Services
• Standards

TECH WATCH 


What's the 411 on GOOG-411?
Just as Google has become synonymous with "performing a Web search," 411 is understood to mean "information" -- as in "what's the 411?" I was thus surprised to discover, from a billboard, no less, that the king of search is taking on the ...

Apple HTML source reveals 'iPhone Extreme'
"This one's a stretch..." reports AppleInsider. Um, yeah. Reporting on HTML code sightings of product names could be called a stretch, but iPhone Extreme has a ring to it. Now, that sounds like the product Apple should have released first, rather ...

COLUMNISTS

Unified under law
Ephraim Schwartz's Column and Blog (InfoWorld) - In the litigious world we live in, deploying a unified communications platform in your enterprise could...
» MORE COLUMNISTS

MORE INFOWORLD BLOGS


Open Sources 
Product Management
When I joined MySQL four years ago, there was quite a lot of debate about product management. We didn't actually have ...

Zero Day 
Botnet herders tending smaller flocks
New research backs up the theory that botnet operators are keeping their networks smaller in a continued effort to keep ...



• Advice Line
• Database Underground
• The Deep End
• Enterprise Mac
• Geeks in Paradise
• Grid Meter
• The Gripe Line
• InfoWorld Daily
• Inside IT
• IT Troubleshooter
• ITXtreme
• Open Sources
• ProdBlog
• Real World SOA
• Reality Check
• Security Adviser
• SMB IT
• The Storage Network
• Tech Watch
• Virtualization Report
• Zero Day

ADVERTISEMENT


RESOURCE CENTERadvertisement 

GOVERNMENT IT & POLICY
'If you don't go after the network, you're never going to stop these guys. Never.'
From the State Department, All the News for Inquiring Minds
TechPresident, the Internet Citizenry's New Consensus Taker



Sponsored Technology Links

 
 
 HOME  NEWS  BLOGS  PODCASTS  VIDEOS  TECHNOLOGIES  TEST CENTER  EVENTS  CAREERS   About | Advertise | Awards | RSS | Contact Us 

Copyright © 2008, Reprints, Permissions, Licensing, IDG Network, Privacy Policy, Terms of Service.
All Rights reserved. InfoWorld is a leading publisher of technology information and product reviews on topics including viruses,
phishing, worms, firewalls, security, servers, storage, networking, wireless, databases, and web services.

CIO :: ComputerWorld :: CSO :: Demo :: GamePro :: Games.net :: IDG Connect :: IDG World Expo
Industry Standard :: IT World :: JavaWorld :: LinuxWorld :: MacUser :: Macworld :: Network World :: PC World :: Playlist