A framework for building behaviour-driven tests in fluent Java. Copyright 2010 youDevise, Ltd..
Download the Narrative jar file and put it in your classpath where your test code can see it.
Here is a typical Narrative test (the object under test is a very simple calculator):
@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()).should_be( equalTo("4"));
}
To make this test work, you need to define:
operator, anActorwhich manipulates the calculatorpress()andthe_displayed_value(), which tell theoperatorto perform actions on the calculator
You can see these implementations in our most basic example. We plan to add more examples in the examples directory of the source code.
We build using Gradle. But you don't need Gradle installed to build Narrative.
In the Narrative home directory, type ./gradlew (on Linux and Mac) or gradlew.bat (on Windows). This will build, run tests, and put Narrative.jar in build/libs.
Use gradle to build, run tests, and produce the Narrative.jar in build/libs.
Open source under the very permissive MIT license.
A project of youDevise. We're hiring!
Inspired by JNarrate, a RiverGlide idea.