| Useful tricks in easyb - tags and parallel tests |
|
|
|
| Thursday, 22 July 2010 06:38 |
|
Easyb is an excellent BDD testing framework, with a heap of very cool features. In this article, we look at two more recent features: tags and parallel tests. If you're looking for a good Behavior-Driven Development (BDD) or Acceptance-Test Driven Development (ATDD), you owe it to yourself to check out Easyb. Easyb is a great BDD-style testing framework where you express your tests as "stories" and "scenarios", using a highly-readable form based on the familiar "given-when-then" structure. A simple story (containing a single scenario) is shown here:
One of the nice things about easyb is that this is actually a fully executable easyb story - put it in a file called (say) When you are ready to actually implement this story, you add the appropriate code into each step. For example, here is an example of an acceptance-test from a web application implementing Conway's Game Of Life:
Easyb also supports tags, which are a very flexible way of categorizing your stories. For example, you can use tags to identify stories related to a particular feature, or to identify the stories being implemented in the current sprint. Or you can use tags to identify a story with the corresponding issue in your issue tracking system. If you identify all of the stories in the current sprint, for example, you can easily set up a build configuration to run, and report on, just the stories for this sprint. Of course your full build would run all of your stories, but this special sprint-specific build is a great reporting tool to let you know which stories have been completed and which are still pending implementation. Easyb tags are easy to use. You can add a tag to a story as shown here:
You can put as many tags as you want on a story - here's an example of a story with two tags:
In the current version of easyb, you can only apply tags to stories, not scenarios - scenario-based tagging is planned for a future version. The latest version of the Easyb Maven plugin (version 0.9.7-1) provides full support for tags. For example, you could run only the 'sprint-2' stories using the following configuration:
Another very useful trick is parallel testing. I use easyb extensively for acceptance tests, involving web tests or other end-to-end tests. With lots of I/O and database interaction, these tests are perfect candidates for being run in parallel. If you add the
But wait! There's more! Easyb is a dynamic project with some very smart dudes working on it, and there are some very cool new features are in the pipeline, including data-driven tests and JUnit-compatible reports! Watch this space! If you want to learn more about BDD and ATDD, be sure to check out the upcoming Java Power Tools Bootcamps, coming up soon in Wellington, London and Canberra.
Bookmark
Email this
Trackback(0)
Comments (0)
![]() Write comment
|
|