The tenth time you say it, decide that it’s wrong

That title seems like a good motto in general. Here’s a specific instance.

I was on a short consulting trip recently. We talked about Fit. I said the two things that I’ve said to clients at least ten times:

“I recommend using Fit when the product director wants to read the tests or when the data is naturally tabular. If the product director doesn’t care or if the test is a do-this-do-that-check-this type test, I’d rather you used xUnit.”

“There are no decent HTML editors. The most tolerable I’ve found is OpenOffice, but they’re all a pain when you want to modify tables.”

There’s a contradiction here. If the product director doesn’t care, why would you write a tabular test in HTML? Because using xUnit means you have to keep columns aligned, and that’s a pain. So use HTML and have the browser line up the columns. But I just said that editing HTML is also a pain. And I never gave much thought to which is the greater pain.

Well, now I have. Here’s a set of tests for business rules similar to the ones the client uses (obfuscated so that the company can’t be identified):


require "set-standalone-test-paths.rb" unless $started_from_rakefile
require ‘test/util/product-specific/seat-allocation-detailer’
 
 
class SeatAllocationTests < SeatAllocationDetailer
   
  def test_airlines_can_increase_allocation_if_allowed
 
    airline_can_increase_allocation 
 
    header   ’current allocation’,   ’airline suggestion’, ’our new allocation?’

    check       11,                      20,                    20
    check       22,                      5,                     :unchanged
  end
   
  def test_airlines_cannot_change_allocation_unless_allowed
 
      airline_cannot_increase_allocation
 
      header   ’current allocation’,   ’airline suggestion’, ’our new allocation?’ 

      check       11,                      20,                    :unchanged
      check       22,                      5,                     :unchanged
  end
 
  def test_airline_can_reduce_and_increase_our_allocation
 
      airline_can_increase_AND_decrease_allocation
 
      header   ’current allocation’,  ’seats sold’, ’airline suggestion’, ’our new allocation?’ 
      check       11,                      5,            5,                 5 
      check       22,                      6,            5,                 :unchanged
      check       33,                      7,           44,                 44 
  end
 
 
end
 

I’ve written a pile of code to make those tests pass, doing some fiddling with them along the way. Subjectively, making a small allowance for bias, I’m thinking it’s been about the same pain as editing HTML. If I wasn’t a complete novice at TextMate, it would probably be less. (Surely TextMate must have an equivalent of a Back button so that you can flip between files easily even if you haven’t dragged the tabs to be next to each other.)

I even think this test isn’t horribly unreadable for a non-technical reader once you tell her to ignore the starting and trailing gobbledeegook, underscores, and quotes. (And it wouldn’t be too hard to write a script that did that for her, or even one that generated HTML.)

The output of a failing test is much less appealing to a product director, but it’s more appealing to someone actually working with that output (a programmer or tester): it’s got a stack trace, probably one that’s clickable.

This approach would encourage people to write test fixtures in Ruby, which is considerably faster than doing it in Java or C#. And it makes fixture-writing accessible to the well-read tester. In this particular case, the app communicates with the outside world via XML over the network, FTP files, and a database, so there’s no need to link the fixtures into the code. If it worked through a GUI, some remote procedure call interface would have to be added, but I persist in thinking that’s not too much to ask.

If anyone wants to pursue this approach on real code, let me know. You’ll get a 50% break on my consulting rate. I make the same offer about my prototype graphical tests.

7 Responses to “The tenth time you say it, decide that it’s wrong”

  1. JeffreyFredrick Says:

    Cool!

    I would also think that in a decent editor (like emacs ;)) you could have a mode that would make it far easier to keep the indentation right automatically.

  2. Brian Marick Says:

    I think M-x picture-mode is supposed to do that, but I always mess things up just as bad.

  3. john hume Says:

    Re TextMate’s back, the Go to File window lists recently edited files in reverse chronological order, so Command-t, Return is what you want.
    -john.

  4. KevinRutherford Says:

    Spreadsheets are a lot easier to edit than HTML, and I believe Fit can read Excel - would that help?

  5. Brian Marick Says:

    I only tried Fit-with-excel once years ago, so I have no reasonable opinion. My unreasonable opinion is that it’s excellent for test input, maybe excellent for test editing, OK for test display, but as weak as HTML for the back end (making the program pass, and keep passing, the test).

  6. Exploration Through Example » Blog Archive » MoB-FAT 1: Controller channels Says:

    […] The sample application is only a realistic sketch. It pretends to be the server part of a system used by travel agents. For my own convenience, I wrote the application in Ruby, but I’m treating it just as I would were it in Java. The tests are written in Ruby for the reasons I gave earlier. […]

  7. Curt Sampson Says:

    As a programmer, i’ve always hated the lack of flexability in FIT: it seemed hard to use because it was hard to make sophisticated tests that still had a simple and readable “top level.”

    I’ve been using Ruby for web testing for ages, and I feel that it’s no harder to read, even for non-techies, once you get over the “it’s not in Excel or Word” psychological barrier.

    The more user-oriented tests I’ve done in this mold are much like yours, but with “higher-level” support functions, and oriented toward being more “englishy.” E.g., when a customer required he had google analytics working on certain pages:

    def test_google_analytics_tracking_code_exists
    %w[
    /pc/
    /pc/mobile/
    /pc/shop/
    /pc/products/
    /ml/XXX
    /send-mail/AAAAAA
    ].each {
    |uri| assert_analytics_code_present(uri)
    }
    end

    Do the footers come out in the right language, and have the right data?

    def test_footer_en
    assert_get ‘/en/page/top’
    assert_body_match ‘日本語
    assert_body_match ‘top
    assert_body_match ‘XXX Co. Copyright 2006′
    end

    def test_footer_ja
    assert_get_response ‘/ja/page/top’
    assert_body_match ‘English
    assert_body_match ‘top
    assert_body_match ‘XXX Co. Copyright 2006′
    end

    Sometimes I name all the pages, so you can do things such as add parameters, post, and make sure that you went to the “main” page or “failed-login” page. For web sites with databases, there are routines to assert that a user is or isn’t in the db, and so on, so that you can test registration.

    All this is dead easy in ruby, and if you hide all the support stuff in files in another directory, you can aim a business guy a the folder full of “high level” tests, associate the extensions with a simple text editor, and he can easily examine the current tests at any time.

    He still needs to work witha programmer to change the tests, but for other reasons (particularly deciding what to test and how to test it in the first place), he’s going to have to do that anyway.

Leave a Reply

You must be logged in to post a comment.


  • Buy Cheapest fluoxetine cod Online Best Online. Buy Medications Online.
  • Buy Cheapest diazepam generics Now Cheap Online Pharmacy. WorldWide Shipping.
  • Buy Cheapest trazodone for sleep Online Best Drugstore. Free Viagra Pills!
  • Buy Cheapest does cialis work Online Best Internet. Top Online Pharmacy.
  • Buy Cheapest viagra generic Online Cheap Prescription Drugs. Best Internet.
  • Buy Cheap clomid get pregnant Now Cheap Pharmacy Online. Cheap Online Pharmacy.
  • Buy Cheapest diet pills for weight loss Now No Prescription Needed. Best Drugstore.
  • Buy Cheapest codeine buy Online Order Cheap Meds Without Rx. Low Prices.
  • Buy Cheap purchase xenical Online Discount Pharmacy Online. Best Prices.
  • Buy Cheapest viagra in mexico Online Drugs, Health And Beauty. Best Internet.
  • Buy Cheap buy cheap generic viagra Now Free Viagra Pills! Guaranteed Shipping.
  • Buy Cheapest discount weight loss suppliments Now Best Prices. No Prescription Needed.
  • Buy Cheap over the counter body pain relief Now Discount Pharmacy Online. Best Drugstore.
  • Buy Cheap levitra levitria Online Cheap Pharmacy Online. Guaranteed Shipping.
  • Buy Cheap natural viagra alternatives Now Pharmacy Store. Order Cheap Meds Without Rx.
  • Buy Cheapest very cheap phentermine Now WorldWide Shipping. Cheap Pharmacy Online.
  • Buy Cheap generics for valium Now Guaranteed Shipping. Discount Online Pharmacy.
  • Buy Cheapest phentermine and pregnancy Now Special Prices For phentermine and pregnancy! Pharmacy Store.
  • Buy Cheap clomid and multiple births Now 100% Satisfaction Guaranteed. Low Prices.
  • Buy Cheap tramadol recreational Now 100% Satisfaction Guaranteed. Low Prices.
  • Buy Cheap levitra facts Online 100% Satisfaction Guaranteed. Best Online.
  • Buy Cheap ativan information Online Cheap Pharmacy Online. Guaranteed Shipping.
  • Buy Cheap cialis mail order medication Online Free Viagra Pills! WorldWide Shipping.
  • Buy Cheapest buy hair loss medicine stop Now Best Prices. Order Cheap Meds Without Rx.
  • Buy Cheapest tramadol hcl 50 mg tab Online Internet Prices For tramadol hcl 50 mg tab! Low Prices.
  • Buy Cheapest acne medication pills Now Discount Online Pharmacy. Low Prices.
  • Buy Cheapest cheapest ultram Now Online Medical Shop. Cheap Pharmacy Online.
  • Buy Cheap buy phentermine diet pill Now Drugs, Health And Beauty. Online Medical Shop.
  • Buying Cheap real phentermine. Offshore Pharmacy, Good Prices. Best Internet.
  • Buy Cheap viagra buy india Online Cheap Prescription Drugs. Best Internet.
  • Buy Cheap pain medicine online Now Order Cheap Meds Without Rx. Best Prices.
  • Buy Cheap drugs on line Now All Medications Are Certificated! Best Prices.
  • Buy Cheap viagra super active Online Cheap Online Pharmacy. Pharmacy Store.
  • Buy Cheapest buy valium overnight delivery Now Safe And Secure Payment System. Low Prices.
  • Buy Cheapest cialis 30 oral Online Best Drugstore. Free Viagra Pills!
  • Buy Cheapest nonprescription pain killer Now Best Prices. Buy Medications Online.
  • Buy Cheapest weight loss probiotics Now Online Medical Shop. WorldWide Shipping.
  • Buy Cheap cialis levitra viagra Now 24/Internet)(safe Pharmacy. Best Drugstore.
  • Buy Cheap fluconazole 150mg Now Best Drugstore. Internet Prices For fluconazole 150mg!
  • Buy Cheapest phentermine online directory Online Best Internet. Top Online Pharmacy.
  • Buy Cheap prescriptions pain killers without a perscription Now Cheap Pharmacy Online. 24/Online Pharmacy.
  • Buy Cheapest xanax generics Online Cheap Prescription Drugs. Best Internet.
  • Buy Cheap fat weight loss products Online Low Prices. Order Cheap Meds Without Rx.
  • xanax usa Online Without Prescription Best Prices. Best Internet.
  • Buy Cheapest multiple prescriptions of xanax Now Best Drugstore. No Prescription Needed.
  • Buy Cheap where to buy valium Now The Largest Internet Pharmacy. Best Prices.
  • Buy diflucan pill Without Prescription Doctor. Best Prices. Best Internet.
  • Buy Cheap anti depression tablets Online No Prescription Needed. Best Drugstore.
  • Buy Cheapest order amoxicillin Now Cheap Pharmacy Online. WorldWide Shipping.
  • Buy Cheap 100mg tramadol Now Cheap Prescription Drugs. Best Drugstore.
  • Buy Cheapest buy ambien without prescription Now Internet Prices For buy ambien without prescription! Best Online.
  • Buy Cheapest does buspar work Now Pharmacy Store. Online Medical Shop.
  • Buy Cheap impotence levitra Online WorldWide Shipping. Guaranteed Shipping.
  • Buy Cheapest ambien long term effects Now No Prescription Needed. WorldWide Shipping.
  • Buy buy codeine no prescription Without Prescription Doctor. Pharmacy Store. Low Prices.
  • Buy Cheapest tramadol info Online Cheap Online Pharmacy. Best Online.
  • Buy Cheapest cheap buspar Now Best Prices. The Largest Internet Pharmacy.
  • Buy Cheap phentermine online Online Best Prices. Online Prices For phentermine online!
  • Buy Cheap buy aspirin witn codeine from canada Now 24/Online Pharmacy. Cheap Pharmacy Online.
  • Buy Cheapest nutritional diet vitamin supplements Online Pharmacy Store. Buy Medications Online.
  • Buy Cheapest cheap generic cialis Now Pharmacy Store. Discount Pharmacy Online.
  • Buy Cheapest order spironolactone Online Best Internet. Cheap Online Pharmacy.
  • Buy Cheap long term anxiety treatment Now Order Cheap Meds Without Rx. Best Prices.
  • Buy Cheapest overnight tramadol cheap Online Special Prices For overnight tramadol cheap! Best Prices.
  • Buy Cheapest buy diet pills in uk Now Pharmacy At The Best Price! Best Drugstore.
  • Buy Cheapest order plavix Online Top Online Pharmacy. Best Internet.
  • zoloft lexapro Online Without Prescription Best Online. Free Viagra Pills!
  • Buy Cheap clonazepam drug Online Pharmacy Store. Drugs, Health And Beauty.
  • Buy Cheapest online medicine Online Discount Pharmacy Online. Best Internet.
  • Buy Cheap pharmacy anxiety Online The Largest Internet Pharmacy. Best Online.
  • Buy Cheapest codeine solution Now Best Online. Top Online Pharmacy Supplier.
  • low cost xenical Online Without Prescription Low Prices. Pharmacy Store.
  • Buy Cheap effects of lasix Now Best Online. Order Cheap Meds Without Rx.
  • Buy Cheap overnight delivery ativan Online Best Online. 24/Internet)(safe Pharmacy.
  • Buy Cheapest viagra buy Online Online Prices For viagra buy! Low Prices.
  • Buy Cheap how long does levitra last Online Top Online Pharmacy. Online Medical Shop.
  • Buy Cheap vitamin supplement Online Pharmacy At The Best Price! Low Prices.
  • Buy Cheap pain meds without prescriptions Now Cheap Pharmacy Online. 24/Online Pharmacy.
  • Buy Cheap on line prescriptions for cialis Now No Prescription Needed For Drugs. Best Online.
  • Buy Cheapest cialis line order Now Best Drugstore. Buy Medications Online.
  • Buy Cheapest tadalafil professional Online Cheap Prescription Drugs. Best Prices.
  • Buy order appetite suppressants online Online Without Prescription. Internet Prices For order appetite suppressants online!
  • Buy Cheap valium about Now Best Internet. Pharmacy At The Best Price!
  • Buy overnight shipping of cialis Without Prescription Doctor. Best Prices. Best Online.
  • Buy Cheapest valium no rx Now Best Drugstore. Buy Medications Online.
  • Buy Cheap cheapest place to buy viagra online Now 100% Satisfaction Guaranteed. Best Drugstore.
  • Buy Cheap compare viagra cialis levitra Now WorldWide Shipping. Cheap Pharmacy Online.
  • Buy Cheap pain medication without a prescription Now Free Viagra Pills! Internet Prices For pain medication without a prescription!
  • Buy Cheap wholesale medications Now Buy Medications Online. 24/Online Pharmacy.
  • Buy Cheap overnight shipping of cialis Now Cheap Pharmacy Online. Online Medical Shop.
  • Buy Cheap cialis impotence drug eli lilly co Now Best Prices. Internet Prices For cialis impotence drug eli lilly co!
  • Buy Cheap online diet meds Now Drugs, Health And Beauty. Guaranteed Shipping.
  • Buy Cheap levaquin 500 mg Now Free Viagra Pills! Special Prices For levaquin 500 mg!
  • Buy Cheapest diet patch in canada Online Best Drugstore. Guaranteed Shipping.
  • Buy Cheapest do diet pills really work Online No Prescription Needed. Best Online.
  • Buy Cheapest antidepressant pills Now Low Prices. Safe And Secure Payment System.
  • Buy Cheap reliable online pharmacies Online Best Drugstore. Pharmacy At The Best Price!
  • Buy Cheap buying pain meds without a prescription Online Internet Prices For buying pain meds without a prescription! Best Online.
  • Buying Cheapest xanax and weight loss. Mexican Rx, Best Prices. Free Viagra Pills!
  • Buy Cheapest buy valium cheap Now Low Prices. Drugs, Health And Beauty.