[TFUI] A Small Success

Ron Jeffries <[email protected]>
Newsgroups gmane.comp.programming.test-first-user-interfaces
Organization XProgramming.com
Message-ID <[email protected]>
On the TDD list someone commented about button hookup not being a problem,
and I remarked that in fact I had had just that defect the other day, in my
new blog software, and therefore I was obligated to write a test for it but
didn't know how.

Hristo Deshev suggested NUnitAsp. I had been misled about what it was (I
think there might be two programs by that name). So, in the interest of
honest reporting, I downloaded it and tried it.

Here's my first test. It tests that when you click the button it goes to
the right place, which of course includes the check that it's hooked up. I
haven't checked the hookup directly and don't know yet how to do it, but
I'm happy for now because this test actually tests what I care about.

It was pretty easy:

using System;
using NUnit.Extensions.Asp; 
using NUnit.Extensions.Asp.AspTester; 

namespace Blog {

  public class TestNUnitAsp : WebFormTestCase {
    public TestNUnitAsp() {
    }

    public void TestNoPassword() {
      Browser.GetPage("http://localhost/Blog/Page.aspx");
      ButtonTester edit = new ButtonTester("EditButton", CurrentWebForm);
      AssertVisibility(edit, true);
      edit.Click();
      string newUrl = Browser.CurrentUrl.PathAndQuery;
      AssertEquals("/Blog/Page.aspx?display=PasswordRequired", newUrl);
    }
  }
}

Ron Jeffries
www.XProgramming.com
Tough life is. Then die you do. --Yoda (personal communication)




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Yahoo! Domains - Claim yours for only $14.70
http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/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/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.