Clone wiki

JNarrate / Examples

Let's say you were building a Wiki application. One of the first things you'd need to be able to do is install it. One of the other things you might want to do is edit the page, completely changing the content.

Here's how you would represent those stories with JNarrate:

Installation Story

public class InstallStory extends AbstractExampleStory {
	 * As a Web User
	 * I want the Wiki to install itself the first time I run it
	 * So that I can save time by not having to learn a special installation procedure

	@Test public void shouldStartUpWithCleanInstall() throws Exception {

		Then.the(textOnTheScreen().ofThe(user)).shouldBe("\r\n\r\n\r\nWelcome to the Wonderful World of FitNesse!");

Editing a Page Story

public class EditAPageStory extends AbstractExampleStory {
	 * As a Web User
	 * I want to be able to change the content of the wiki page
	 * So that I can communicate my own information to other readers of the wiki
	@Test public void shouldBeAbleToEditAPage() {

		When.the(user).attemptsTo(changeTheContent().to("Welcome to Acceptance Test Driven Development"));

		Then.the(textOnTheScreen().ofThe(user)).shouldBe("Welcome to Acceptance Test Driven Development");

Examples can also be viewed here: