## Getting Started

### Write a textual story

Create a textual story file with a name that expresses the behaviour to verify, e.g. i_can_toggle_a_cell.story and define steps in it:

    Given a 5 by 5 game
    When I toggle the cell at (2, 3)
    Then the grid should look like
    .....
    .....
    .....
    ..X..
    .....
    When I toggle the cell at (2, 4)
    Then the grid should look like
    .....
    .....
    .....
    ..X..
    ..X..
    When I toggle the cell at (2, 3)
    Then the grid should look like
    .....
    .....
    .....
    .....
    ..X..

Steps must start with one of the keywords highlighted (see Concepts for more details) and are not limited to a single line. Also, unless otherwise indicated, a story has at least one implicit scenario, each of which is a collection of steps.

### Map steps to Java methods

Define your GridSteps class, a simple POJO, which will contain the Java methods that are mapped to the textual steps. The methods need to annotated with one of the JBehave annotations and the annotated value should contain a regex pattern that matches the textual step:

### Configure a Java Embeddable class

Define your Embeddable class which provides the link between the JBehave's executor framework (called Embedder) and the textual stories. The simplest configuration is a one-to-one mapping between a Java class and a textual story file. So we'll extend JUnitStory and give it a name that can be (conventionally) mapped to the textual story filename, e.g. ICanToggleACell.java:

The story is now configured to use the GridSteps that defines mappings between the textual steps and the Java methods to be executed.

### Run story

Open your favourite IDE, the ICanToggleACell.java class will allow itself to run as a JUnit test. Be sure to check that you have all the required dependencies in your classpath.

### View generated reports

Since we've defined two reports, CONSOLE and TXT, you should see during the running of the story the output being written the System.out. In addition, the same output will also have been written to a file in target/jbehave.

## Next?

JBehave development has been example-driven and it is very instructive to go through one or more working examples in the source repository, which illustrate the features of JBehave. The gameoflife example contains much of the above and is ready to be run. Be sure to read about running examples and running stories.