h1. Bhave - Web-based BDD framework based on Play!, WebDriver/Selenium2 and Knockout.js

_Written by Ed Southey_

p. Bhave allows you to easily create 'Acceptance Tests' of your web-accessible application, by turning natural language constructs into WebDriver commands to drive a real browser to interact with your application.

h2. Motivation

p. BDD rocks.  I won't go into details on BDD specifics (Google is your friend).  Selenese is all very well and good, but it still requires intimate knowledge of the syntax.  Guiding the user through syntax or allowing them to create their own opens the door to a wider range of people being able to write and more importantly read the tests.

h2. Installation


* Use the standard Play module installation command:

bc. play install bhave 0.1

* Add the dependency to your project:

bc. require:
    - play -> bhave 0.1:
        transitive: false

Bhave has a dependencies on Selenium and we don't want those jars to be copied over to the application's lib directory. That is why we specified @transitive: false@.

* Run

bc. play dependencies --sync

h2. Set Up

In your routes file you should include the following line to allow access through to the underlying Bhave module views etc:

bc. *   /   module:bhave

In your @application.conf@ there are three properties that can/should be included:

bc. bhave.local.selenium.server.on=true

Whether to fire up a local Selenium server on startup.  This is useful when you are developing/debugging.  If you have a Selenium Grid or external Selenium Servers, then this is unnecessary.

bc. bhave.local.selenium.server.port=9001

What port your local Selenium server should start on.

bc. bhave.chrome.driver.path=

If you want to run tests in Chrome locally, then ChromeDriver ("http://code.google.com/p/chromedriver/":http://code.google.com/p/chromedriver/) needs to be on the path or specified here.

To persist your data, you'll need to tell Play! to use a 'real' database, rather than the in-memory one by default.  For performance/architectural reasons, you may want to use a MySQL/Postgres/Oracle database, see Play! documentation for configuring this easily.  For testing/development purposes, a simple file-system based h2 database is fine.  Change this line:

bc. #db=mem

to 

bc. db=fs


h2. Usage

Fire up your application with:

bc. play run

Then simply access your application on http://localhost:9000/ (by default) and start creating tests!

h2. Project Information

Source code: "https://github.com/rugbyhead/bhave":https://github.com/rugbyhead/bhave
Issue tracking: "https://github.com/rugbyhead/bhave/issues":https://github.com/rugbyhead/bhave/issues
