StoryQ and WatiN: Handle Multiple Pages

Jun 3, 2011 at 1:30 AM

Hi,

  I just tried to incorporate the StoryQ to WatiN web browser test and it works fine. It's not really a problem handling one page or two. But I now have multiple page that is navigated via Next and Back Button. What's the best way to handle this in StoryQ. Example I have 20 pages before I can go to the page 15 I have to complete the 1st to 14th page. And also a scenario in every page with business rules example I want to test the field validation.

  Here's what I have so far:

  [TestMethod]

  public void Complete_Registration_Form()

  {

        new Story("Registration for Something")
                .InOrderTo("Complete the Registration")
                .AsA("User")
                .IWant("To go to the Registration Page")

        .WithScenario("Step 01")

         ...

        .WithScenario("Step 02")

         ....

         .WithScenario("Step 03")

         ...

         .WithScenario("Step 20")

         ...

         .Execute();

  }

 The TestMethod above is considered as "happy path". If I want to create new story example "Page Registration Business Rule Violation on Page 3", I have to copy the scenarios above that will make it passed.

 Am I doing it right?

Thanks,

-Ronald

Jun 6, 2011 at 5:52 AM

I think I have a solution to this.

What I did is I created every story for each Steps (page). Then make a call on the required steps to get into the desired step.

[TestInitialize]
        public void Setup()
        {
            new Step1().Success();
            new Step2().Success();
            new Step3().Success();
            new Step4().Success();
        }

That way it's all setup.