title: Confused about my Gherkin - navigation between web pages
body: <p>I'm just starting out with BDD on a web project, using SpecFlow and WatiN to automate things through the browser, and I'm not quite sure how to write my steps.</p>
  
  <p>I'm trying to drive everything from the tests, and in a TDD manner, not write anything unless it's needed to make a test pass.  (I am also doing unit tests to drive the detail, but this question isn't about that).  One thing I'm confused about is navigation between pages, and if/how this should be defined in the specs.</p>
  
  <p>The first test involves entering some details and ensuring they get displayed in a list.   My first attempt goes something like this:</p>
  
  <blockquote>
    <p>Scenario: Add Details Option 1</p>
    
    <p>Given I am on the "Home" page<br>
    When I click "Add Details"<br>
    And I enter "John Smith" in the Name field<br>
    And I click "Save"<br>
    Then "John Smith" appears in the list  </p>
  </blockquote>
  
  <p>However, this involves navigating between a couple of pages, so I don't know if that needs to be explicit - otherwise, I just have to assume I'm on the right page, or steps which are apparently unrelated to which page I'm on (for example, 'When I click Add Details') have assertions to check which page I'm on.</p>
  
  <p>Do we check the pages with explicit steps in the scenario?</p>
  
  <blockquote>
    <p>Scenario: Add Details Option 2</p>
    
    <p>Given I am on the "Home" page<br>
    When I click "Add Details"<br>
    <strong>And I am on the "Add Details" page</strong><br>
    And I enter "John Smith" in the Name field<br>
    And I click "Save"<br>
    <strong>And I am on the "Home" page</strong><br>
    Then "John Smith" appears in the list  </p>
  </blockquote>
  
  <p>Or do we do it in the steps from option 1, just not mentioning it explicitly?</p>
  
  <p>For example, Should clicking on 'Add Details' check that we end up on the right page?</p>
  
  <pre><code>public void WhenIClickAddDetils{
      // syntax probably wrong, not important
      Assert.That(IE.Button("AddDetails").exists);
      IE.Button("AddDetails").click();
  
      Assert.That(IE.PageTitle = "Add Details")); // do we check this here?
  }
  </code></pre>
  
  <p>Or should we check we are on the right page before entering the details?</p>
  
  <pre><code>public void WhenIEnterDetils{
      Assert.That(IE.PageTitle = "Add Details")); // do we check this here?
  
      IE.TextField("Name").value = "John Smith";
      // etc
  }
  </code></pre>
  
  <p>Alternatively, we could start with</p>
  
  <blockquote>
    <p>Given I am on the "Add Details" page</p>
  </blockquote>
  
  <p>And just make that step include starting on the home page and clicking the 'Add Details button' in order to get to that page.  Although this still leaves the same issue with navigating back to the Home page after we click 'Save'.</p>
  
  <p>Any thoughts?</p>