Title: [1268] trunk/core/distribution/src/site/content/getting-started.html: Re-worked getting started page to have Steps class defined before Scenario class.
Revision
1268
Author
mauro
Date
2009-09-20 06:04:00 -0500 (Sun, 20 Sep 2009)

Log Message

Re-worked getting started page to have Steps class defined before Scenario class.

Modified Paths

Diff

Modified: trunk/core/distribution/src/site/content/getting-started.html (1267 => 1268)

--- trunk/core/distribution/src/site/content/getting-started.html	2009-09-20 10:11:24 UTC (rev 1267)
+++ trunk/core/distribution/src/site/content/getting-started.html	2009-09-20 11:04:00 UTC (rev 1268)
@@ -10,9 +10,8 @@
 
 <h3>Write a textual scenario</h3>
 
-<p>To start using JBehave, simply name your scenario file with
-underscores, eg i_can_toggle_a_cell (although the file name resolution
-is configurable) and define steps in it:</p>
+<p>Create a textual scenario file with a name that expresses the
+behaviour to verify, e.g. i_can_toggle_a_cell and define steps in it:</p>
 <pre class="brush: bdd">
       Given a 5 by 5 game
       When I toggle the cell at (2, 3)
@@ -37,32 +36,20 @@
       .....
       ..X..
 </pre>
+<p>Steps must start with one of the keywords highlighted (see <a
+    href="" Concepts</a> for more details) and are
+not limited to a single line.</p>
 
-<h3>Map textual scenario to Java class</h3>
+<h3>Map scenario steps to Java methods</h3>
 
-<p>Extend the <a
-    href=""
-class with a similarly named Java class: <b>ICanToggleACell.java</b>
-</p>
-
-<pre class="brush: java">
-      public class ICanToggleACell extends Scenario {
-
-        public ICanToggleACell() {
-            super(new GridSteps()); // varargs, can have lots of steps
-        }
-      }
-  </pre>
-
-<h3>Map textual scenario steps to Java methods</h3>
-
-<p>Extend the <a
+<p>Define your <a
     href=""
-class: this is where your steps will be defined, and you can have as
-many as you want. <a
-    href=""
-methods in your step class to match the ones in your plain text
-scenario.</p>
+class, e.g. call it <b>GridSteps</b>, which will contain the Java
+methods that are mapped to the textual steps. The methods need to
+annotated with one of the JBehave <a
+    href=""
+and the annotated value should contain a regex pattern that matches the
+textual step:</p>
 
 <pre class="brush: java">
       public class GridSteps extends Steps {
@@ -90,10 +77,29 @@
       }
 </pre>
 
-<h3>Run Scenario</h3>
+<h3>Map scenario to Java class</h3>
 
-<p>Run your new Java Scenario as JUnit test, in your favourite IDE.</p>
+<p>Define your <a
+    href=""
+class with a name that can be mapped to the textual scenario filename,
+e.g. <b>ICanToggleACell.java</b>:</p>
 
+<pre class="brush: java">
+      public class ICanToggleACell extends Scenario {
+
+        public ICanToggleACell() {
+            super(new GridSteps()); // varargs, can have lots of steps
+        }
+      }
+</pre>
+<p>The Scenario is now configured to use the <b>GridSteps</b> that
+hold the step mappings.</p>
+
+<h3>Run scenario in IDE</h3>
+
+<p>Open your favourite IDE, the <b>ICanToggleACell.java</b> class
+will allow itself to run as a JUnit test.</p>
+
 <h2>Looking for more examples?</h2>
 
 <span class="followup">JBehave has a number of working <a


To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Reply via email to