What is Thucydides
Thucydides is a tool that lets you use WebDriver-based unit or BDD tests to write more flexible and more reusable WebDriver-based tests, and also to generate documentation about your acceptance tests, including a narrative description of test, along with the corresponding screen shots, and also high-level summaries and aggregations of the test results.
How does it work
Let’s have a look at one of the most common ways of using Thucydides:
1) What are you working on?
First, you create a model of the features and user stories you intend to implement in the next iteration:
2) How do you know it’s done?
Next, describe your high-level acceptance criteria in business terms. Here, we are using easyb, but you could also use just plain JUnit (and soon, Cucumber, Fitnesse, and other popular BDD tools):
3) Details, details
Now, flesh out your acceptance criteria in terms of high level steps (but don’t worry about the implementation yet – we are still thinking “what”, not “how”). Once this is done, you will have a pending acceptance test.
Or, if you prefer JUnit, you could do this:
4) Implement the steps
Now implement the actual test steps using either WebDriver page objects or other test steps. Here you start thinking about implementation:
5) Implement the Page Objects
Next you will need to implement your page objects, if you are not reusing existing ones (which tends to often be the case). These are almost just run-of-the-mill WebDriver page objects, but with a few enhancements:
6) Check out the reports!
Now, when you run your tests, Thucydides will produce a narrative-style report describing not only whether the test succeeded, but what it did:
7) And the pretty pictures
You can also step through the test from the user’s perspective, seeing a sequence of screenshots:
7) Don’t forget the high-level view
Thucydides also provides nice high-level reporting. Here is a report showing all the acceptance criteria for a particular story:
You can also get a high-level picture of your application, in terms of features, stories and acceptance criteria: