[01/26/2007] The Firefox extension is now available for download. It's nowhere near complete yet, but it does have the Acceptance-Fitnesse format to get you started.
[01/19/2007] We have a proof of concept working. I'm using it for a project here and it works fine. Now to productize it..
The Tk-Acceptance Framework contains a series of Fit/Fitnesse/Selenium support libraries you can use for acceptance testing and creating a testing DSL. It also has a script for Selenium IDE to assist in creating test scripts in Fitnesse Wiki format.
Fit allows customers, testers, and programmers to learn what their software should do (versus what it does do). It automatically compares customers' expectations to actual results.
The basic idea of fit is that the business analyst creates a spreadsheet outlining the expectations of the software. This helps clarify the requirements for the developers. Then the Fit library is used to create a test fixture for said spreadssheet. This is similar to a unit test, but with the business analyst requirements, instead of the software class, as its focus.
Fit by itself is great, but it needs a couple of things to augment it. First off, it needs a place "close to the code" to put the requirements. This "place" needs to be directly editable by the business analysts and needs to be "aware" of Fit and the idea of running tests. This is solved by the addition of FitNesse. Fitnesse is a wiki that is fit aware (indeed the Fitnesse download contains fit). It has direct "Test" buttons on the pages where you put fixtures, it can launch the test fixtures and set the appropriate classpath while doing it, etcetera.
A great way to set up Fitnesse on your own machine is by using the Band XI Fitnesse plugin.
Another problem we have when doing fitnesse is that a lot of times business analysts can only visualize things on the UI. If it doesn't work on the web UI, then it's no use for the "rules" to be right. For this you need Selenium. Selenium allows you to create web test scripts (click on checkbox, enter "mylogin" on a login box, etcetera).
However, Selenium and Fitnesse do not talk to each other by default.
You can quickly come up with test scripts by just browsing the web using Selenium IDE. We also provide some extensions to make this easier.
A Domain Specific Language for testing helps business analysts define what the business rules should be on their own terms. Business analysts are very good at thinking on specific example terms and by example. Creating Fixtures that match the way they see the world allows the team to be able to verify that the software really is what is needed, as opposed to whether it works or not.
The way you would go about creating a testing DSL is by running the selenium IDE, and then turning the activity you create into a single method in your own fixture. For example, you can use Selenium IDE to log in and then create a fixture called LoginFixture.
TK-Acceptance does two things: It provides a decorator to execute selenium commands directly from test fixtures, and it provides the basic construct of selenium execution so you can quickly create fixtures of your own that use selenium to test your web application.
TK-Acceptance requires fitnesse (which has fit), and selenium-rc. They're both on the lib directory.
The Tk-Acceptance has two fixtures (package is com.tacitknowledge.fitselenium):
- RuntimeEnvironmentFixture - You can set this fixture on a page to set up the location of the web app you are testing, and the browser name. Do something such as:
| webAppRoot | http://localhost:8080 |
| browserName | *firefox |
- FitSeleniumFixture - This is a wrapper around the selenium browser driver. The end result of this wrapping exercise is that a table-ized selenium test will run on it.
|open | "/"|
|assertTitle | "Google"|
|type | "q"| "Selenium DSL"|
|clickAndWait | "btnG"|
|assertTitle | "Selenium DSL - Google Search"|
- BrowserManagerFixture - Typically after each test you want to stop the browser (unless you want to have your fixture do it by itself).
| stopBrowser |
For users of selenium IDE (business analysts and developers alike), there is a script on common called common/acceptance/scripts/selenium-ide/fitnesse-generator.js which will automatically create a test fixture compatible with FitSeleniumFixture, the fixture used for running selenium. This allows people to basically just run a test and paste it on a tk-acceptance enabled fitnesse server.
More documentation will get here soon as we experiment with this on other projects.
Developers can use the fixtures here as base to design their own DSL for testing. If using selenium to test, eventually you will come up with reusable elements. These can be put on a static class so your fixtures can access them.