title: Should your BDD specifications be separated from your UI tests?
body: <p>Yesterday I went to a great presentation by <a href="https://twitter.com/#!/gojkoadzic" rel="nofollow">Gojko Adzic</a> about BDD. I might have missed one or two things he said so here is one question that hopefully will clear somethings up for me.</p>
  
  <p>Often when you see BDD example online they have included steps in the UI. In a gherkin language you can often see something like: </p>
  
  <pre><code>Scenario: Successful booking
      Given I am on the page ...
      When I enter the following ...
  </code></pre>
  
  <p>Or something like that.</p>
  
  <p>My question is, does that really have with BDD to do? Shouldn't BDD be targeted towards the domain and then you have those kind of tests as UI or regression tests. What I am thinking about is something like this use gherkin syntax to describe somekind of booking system:</p>
  
  <p>BDD Spec:</p>
  
  <pre><code>Scenario: Successful booking
      Given I am an authenticated user
      When I place an order with the following items
          | item  | price ($) |
          | book1 | 5         |
      Then I should expect to pay $5
      And I should get a confirmation mail of my order
  </code></pre>
  
  <p>Note that I am not mentoning the UI at all, I am only describing how the domain works and this test should be run on every build. Then you can have your UI test (also gherkin):</p>
  
  <pre><code>Scenario: Successful booking
      Given I am logged in on the site
      And I go to the page for item book1
      And I click add to basket
      Then I should have a basket with 1 item and $5
      When I click checkout
      Then I should get to the checkout page
  </code></pre>
  
  <p>and it continues, maybe it should be separated into two or three scenarios but that is not the point. Theses kind of tests are heavier to run and should probably only be run on nightly builds. The point of the question is still: Should you separated you BDD specs from your UI/regression test.</p>