Narrative gives you the tools to write readable behaviour-driven tests in Java, like this:
1. Describe the desired behaviour in fluent Java:
@Test public void
adds_two_numbers() {
Given.the( operator).was_able_to( press('2'))
.was_able_to( press('+'))
.was_able_to( press('2'));
When.the( operator).attempts_to( press('='));
Then.the( operator).expects_that( the_displayed_value(), is("4"));
}
2. Define one or more Actors and Actions for those Actors to carry out, making your acceptance-test code compile
3. Run your acceptance-test and watch it fail
5. Run your test again and watch it pass
6. Repeat steps 1-5
Resources
Why Narrative?
- Narrative is 100% Java and installation is as simple as adding the Narrative and Hamcrest jars to your classpath.
- Tests you write with Narrative are also 100% Java, so you can
- Refactor your tests using your favourite tools.
- Analyse your tests for errors or conformance to agreed style.
- View and edit your test code seamlessly in your favourite IDE.
- Narrative tests are standard JUnit tests, so you can run them with any standard unit-test tools.
- You use fluent Java to write your tests, so non-technical collaborators (business analysts, testers, even real users!) can read them easily. (Coming soon: HTML conversion of tests, for total readability.)
- Narrative is open source, under the very permissive MIT license, so you can use it in nearly any project.
Acknowledgements
A project of youDevise. We're hiring!
Inspired by JNarrate, a RiverGlide idea.