[TFUI] the simplest test that could possibly fail

"Phlip" <[email protected]> Fri, 9 Sep 2005 09:35:54 -0700
Newsgroups gmane.comp.programming.test-first-user-interfaces
Message-ID <000d01c5b55c$9304ef40$eeddfea9@Marley>
TFUIers:

I'm using WebUnit to test my little Wiki.

This test fails if my built-in server cannot serve the graphic of the mascot
that goes in the upper left corner of the Wiki:

    def test_getPenBird()
     response = Response::get( "http://localhost:8001/images/penBird.gif" )
     assert_no_match /Internal Server Error/, response.body
    end

The test successfully fails if the server cannot yet serve images.
(Naturally, this is the next feature I want to add.)

Now suppose I were too lazy to research what the WebUnit 'response' object
looks like when it holds a healthy graphics object. I could research that,
and add it to the test, or I could pass the test by serving an image.

This test is the simplest that can fail. Some TDD references say "write a
test that can only pass if you have the feature you want." That sounds hard!

I suspect that is a goal, not a rule. Testing legacy situations, including
GUIs, frequently forces you to pass a test, and then inspect the passing
criteria before determining what the test should assert. Your next test of
this kind, naturally, will constrain more.

My test probably represents the extreme of laziness. So where does the
AntiPattern end and the Pattern begin here?

----

BTW, the answer to the technical is this...

     response = Response::get( "http://www.greencheese.org/penBird.gif" )
     assert_match /^GIF89aB/, response.body

...if you don't mind the test constrains you to a particular image format.

-- 
  Phlip
  http://www.greencheese.org/ZeekLand  <-- NOT a blog!!!



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/nhFolB/TM
--------------------------------------------------------------------~-> 

To unsubscribe, email:
TestFirstUserInterfaces-unsubscribe-hHKSG33TihhbjbujkaE4pw@public.gmane.org
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/TestFirstUserInterfaces/

<*> To unsubscribe from this group, send an email to:
    TestFirstUserInterfaces-unsubscribe-hHKSG33TihhbjbujkaE4pw@public.gmane.org

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/