We tried first to write the actual tests with JUnit but somehow the TDD vocabulary of JUnit was not satisfactory when we had been using the JDave BDD framework for our BDD specifications.
In JDave the specifications for one type are put to one class using the naming convention TypeSpec:
Then you create a context representing some state of an object of the type being specified as an inner class and write specifications to that:
And in natural language you read the specifications like this:
Shopping cart specification:
Empty shopping cart:
- is empty
...
We decided that in behaviorish acceptance test language the context is the state of the browser and we wanted to then write something like in the above example. So we created a class called WebSpecification. It also has an inner class WebSpecificationContext that is extended to create the contexts:
The "specification class" is the web browser which is represented in Selenium 2 by the interface WebDriver. The getWebDriver()-method is used to get instance of the currently active driver:
The driver is set by our version of the JDaveRunner, Selenium2JDaveRunner, which sets the driver class based on system property and sets it to the specification before running it: