Welcome to UnixReview.com

Main Menu
  Home
  Archives
  Reviews
  Books
  Geek Links
  Contact Us

Sections
  Regular
    Expressions

  Tool of the Month
  Open Source
  Certification
  Shell Corner
  MySQL


Newsletter
Get the Newsletter
Get the Newsletter

  Print-Friendly Version

Regular Expressions: Fit makes for good tests October 2003
by Cameron Laird and Kathryn Soraiz

Fit is a clever testing framework Ward Cunningham invented to support the acceptance tests that Extreme Programming (XP) needs. Cunningham also invented the WikiWikiWeb, or Wiki, among many other projects.

XP is a development "methodology", "a deliberate and disciplined approach" that, in the case of XP, "emphasizes customer involvement and promotes team work" through "its simple rules and practices". XP is a frequent topic for UnixReview.com articles, including such recent book reviews as Extreme Programming.

A particular focus of XP is testing. XP requires testing, of all kinds, from the first day of a development project. Among other things, this makes XP's success unusually dependent on the cost and results of testing tasks; if testing is expensive or fragile, XP loses any advantages it has.

Practical testing

That logic is a prominent part of XP's background, in fact. XP advocates generally have a lot to say about how testing isn't as tedious or impractical as many programmers seem to believe.
Figure 1
Fit demonstrates that. As Cunningham writes, Fit "is about tests that people can read", such as the example reproduced in Figure 1. The novelty here is that, with Fit, you maintain and extend these tests by filling out simple Web tables. While the implementation of the arithmetic of this example is in Java, management of a test suite doesn't demand knowledge of Java — everything shows up as readable tables like this one. End users can leverage HTML editors to specify and execute individual tests.

Furthermore, you don't even have to implement with Java to benefit from Fit. Although much of the XP literature addresses only Java and C++, most of its ideas apply quite naturally to the high-level languages that interest "Regular Expressions"'s readers. The Fit homepage points to Fit frameworks for several other languages.

This month, we want to direct attention to Dave Thomas' Ruby-based Fit. Thomas is, among other distinctions, co-founder of the Pragmatic Programmer series of books on "Agile methods", related to XP. His distribution unpacks easily and correctly reproduces the Fit model.

While the most natural way to work with Fit is in terms of such Web-based tables as Figure 1, it's intelligently modularized, so its pieces are also available for command-line inspection and automation. Thomas provides a README thats section on "Immediate Gratification" focuses on Web manifestations of Fit. To start using it, you need to:

  tar xf fit.tar
  cd fit
  ruby process_examples.rb

This exercises example test specifications and creates:

  fit/examples/op/Arithmetic.html
  fit/examples/op/Calculator.html
  fit/examples/op/Division.html
  fit/examples/op/DumbCounter.html

which summarize the results in reports, such as:

      ...
  Fit::Summary (source)
  counts       27 right, 2 wrong, 0 ignored, 2 exceptions
  input file   inline
  input update Sun Oct 19 15:38:49 EST 2003
  output file  inline
  run date     Mon Oct 20 11:15:41 EST 2003
     ...

State of the project

Do you see what this gives you? The Web interface makes it practical for an end user, or a least an end user's advocate, to code acceptance tests directly. At the same time, the test runs can feed directly into a whole range of developer-side automations, including nightly regression assurances. All this is packaged in a lightweight Wiki-like bundle that's easy to deploy and nearly maintenance free.

As exciting as Fit is for several leaders in testing circles, it remains a rather juvenile project. The Fit Wiki hasn't grown up enough yet to host the current versions of all the software it appears to have. If you'd like to work with the Ruby version, for example, you're better off getting a copy from our Phaseit, Inc., site. We still haven't figured out satisfying ways to handle testing of exceptions for situations that arise for our customers. We also don't see a good pattern for application of Fit to "sequence-dependent" validations we need, where doing operations:

  A then B then C then D        yields      R

but:

  A then C then B then D        yields      S

On the other hand, Fit's "nimbleness" and portability make for the easy deployment and maintenance that's proven so valuable to Wikis. Fit's also capable enough that to have already inspired an offshoot, Robert C. Martin's Fitnesse, which strengthens the integration of Fit's Wiki and testing aspects.

What challenges does testing present for you? "Regular Expressions" will return to testing topics several times over the coming year; meanwhile, we'd love to hear about your experience with Fit and other testing frameworks.

Kathryn and Cameron run their own consultancy, Phaseit, Inc., specializing in high-reliability and high-performance applications managed by high-level languages. Join them each month as their "Regular Expressions" column explores issues and opportunities that arise in practical application development with scripting languages.



MarketPlace
Join the JCP[sm] program and help continue the advancement of the Java[tm] platform by sharing your views, ideas, and thoughts. Join now.
HP workstation solutions for software developers, engineers and game developers. Are you transitioning to 64bit computing, interested in remote graphics development, or do you need the latest tools for Linux development? Learn more.
Wanna see your ad here?

   
Home | Top



MarketPlace
Join the JCP[sm] program and help continue the advancement of the Java[tm] platform by sharing your views, ideas, and thoughts. Join now.
HP workstation solutions for software developers, engineers and game developers. Are you transitioning to 64bit computing, interested in remote graphics development, or do you need the latest tools for Linux development? Learn more.
Innovative marketing and sales advice exclusively for IT professionals and consultants. Free articles, audio tips, and a weekly newsletter packed with unique, proven strategies to grow your IT business.
One-to-one, scheduled file replication and content synchronization for cross platform replication on Windows, UNIX, Linux, HP and more.
On CVS and thinking about migrating? STOP! CTK, easily installed on top of CVS and your issue tracking system, gives you best of breed CM control, continuous builds, regression tests, and visibility - and best of all, developers love the automation!
Wanna see your ad here?


Copyright © 2004 CMP Media LLC, Privacy Policy
Comments about the Web site: webmaster@unixreview.com
SDMG Web Sites: Byte.com, C/C++ Users Journal, Dr. Dobb's Journal, MSDN Magazine, New Architect, SD Expo, SD Magazine, Sys Admin, The Perl Journal, UnixReview.com, Windows Developer Network

UNIX is a registered trademark of The Open Group in the United States and other countries.

 
web1