Title: [1635] trunk/core/distribution/src/site/content: JBEHAVE-285: Added stepdocs documentation page

Diff

Modified: trunk/core/distribution/src/site/content/release-notes.html (1634 => 1635)

--- trunk/core/distribution/src/site/content/release-notes.html	2010-05-06 16:54:48 UTC (rev 1634)
+++ trunk/core/distribution/src/site/content/release-notes.html	2010-05-07 18:11:40 UTC (rev 1635)
@@ -5,7 +5,7 @@
 </head>
 <body>
 
-<h1>JBehave Core - Version 2.5.5 (May 7, 2010)</h1>
+<h1>JBehave Core - Version 2.5.5 (May 8, 2010)</h1>
             
 <h2>        Improvement
 </h2>
@@ -13,6 +13,13 @@
 <li>[<a href="" -         Report Renderer should be failure aware
 </li>
 </ul>
+        
+<h2>        Task
+</h2>
+<ul>
+<li>[<a href="" -         Add stepdocs documentation page
+</li>
+</ul>
 
 <h1>JBehave Core - Version 2.5.4 (May 5, 2010)</h1>
         

Modified: trunk/core/distribution/src/site/content/sitemap.xml (1634 => 1635)

--- trunk/core/distribution/src/site/content/sitemap.xml	2010-05-06 16:54:48 UTC (rev 1634)
+++ trunk/core/distribution/src/site/content/sitemap.xml	2010-05-07 18:11:40 UTC (rev 1635)
@@ -26,6 +26,7 @@
     <page>pending-steps.html</page>
     <page>configuring-scenarios.html</page>
     <page>running-scenarios.html</page>
+    <page>stepdocs.html</page>
     <page>i18n-scenarios.html</page>
   </section>
   <section>

Added: trunk/core/distribution/src/site/content/stepdocs.html (0 => 1635)

--- trunk/core/distribution/src/site/content/stepdocs.html	                        (rev 0)
+++ trunk/core/distribution/src/site/content/stepdocs.html	2010-05-07 18:11:40 UTC (rev 1635)
@@ -0,0 +1,98 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html>
+<head>
+<title>Stepdocs</title>
+</head>
+
+<body>
+
+<h2>Stepdocs</h2>
+
+<p>The matching of textual steps to Java methods, each representing
+a candidate step, is a key concept in creating a Domain-Specific
+Language (DSL). Once the DSL has been defined, we need a way to display
+the "grammar" of the DSL to enable to scenario writer to exercise that
+grammar in writing the scenarios.</p>
+
+<p>To this end, JBehave provides the concept of <a
+	href=""
+which represents the documentation on a single candidate step as
+annotated method in the <a
+	href=""
+instance. This documentation includes:</p>
+<ul>
+	<li>the associated annotation in the method of the CandidateSteps
+	class</li>
+	<li>the pattern to match the candidate step that is configured in
+	the annotation</li>
+	<li>the alias patterns for the candidate step (optional)</li>
+	<li>the method in the CandidateSteps class</li>
+</ul>
+
+<p>To generate the stepdocs for a given list of CandidateSteps
+instances:</p>
+
+<script type="syntaxhighlighter" class="brush: java"><![CDATA[
+
+  StepdocGenerator generator = new DefaultStepdocGenerator();
+  List<Stepdoc> stepdocs = generator.generate(new TraderSteps(new TradingService()), new BeforeAfterSteps());
+    
+]]></script>
+
+<p>Alternatively, given a RunnableScenario instance:</p>
+
+<script type="syntaxhighlighter" class="brush: java"><![CDATA[
+
+  RunnableScenario scenario = new MyScenario();
+  scenario.generateStepdoc();
+    
+]]></script>
+
+<p>The RunnableScenario. will use the configured <a
+	href=""
+	to report the stepdocs found in the CandidateSteps defined for the scenario.
+</p>	
+
+<h2>Stepdocs via Ant task</h2>
+
+<script type="syntaxhighlighter" class="brush: xml"><![CDATA[
+
+	<taskdef name="stepdoc" classname="org.jbehave.ant.StepdocTask"
+      classpathref="scenario.classpath" />
+    <stepdoc scenarioIncludes="**/scenarios/*.java"
+      scenarioExcludes="**/i18n/scenarios/*.java" classLoaderInjected="false" />
+      
+]]></script>
+
+<p>Remember to include <b>jbehave-ant</b> to your runtime classpath.</p>
+
+<h2>Stepdocs via Maven Plugin</h2>
+
+<script type="syntaxhighlighter" class="brush: xml"><![CDATA[
+   <plugin>
+        <groupId>org.jbehave</groupId>
+        <artifactId>jbehave-maven-plugin</artifactId>
+        <version>[version]</version>
+        <executions>
+          <execution>
+            <id>stepdoc</id>
+            <phase>integration-test</phase>
+            <configuration>
+              <scenarioIncludes>
+                <scenarioInclude>**/scenarios/*.java</scenarioInclude>
+              </scenarioIncludes>
+            </configuration>
+            <goals>
+              <goal>stepdoc</goal>
+            </goals>
+          </execution>
+        </executions>
+    </plugin>
+]]></script>
+
+<div class="clear">
+<hr />
+</div>
+
+</body>
+</html>

Modified: trunk/core/jbehave-core/src/main/java/org/jbehave/scenario/steps/Stepdoc.java (1634 => 1635)

--- trunk/core/jbehave-core/src/main/java/org/jbehave/scenario/steps/Stepdoc.java	2010-05-06 16:54:48 UTC (rev 1634)
+++ trunk/core/jbehave-core/src/main/java/org/jbehave/scenario/steps/Stepdoc.java	2010-05-07 18:11:40 UTC (rev 1635)
@@ -11,14 +11,14 @@
 import org.jbehave.scenario.annotations.When;
 
 /**
- * A Stepdoc represents the documentation on a single {...@link Step}, which
- * includes:
+ * A Stepdoc represents the documentation on a single candidate step, which includes:
  * <ul>
- * <li>the associated annotation in the {...@link Steps} class</li>
- * <li>the pattern to match the candidate step that configured in the annotation
- * </li>
- * <li>the aliases for the step (optional)</li>
- * <li>the matched method inthe {...@link Steps} class</li>
+ * <li>the associated annotation in the method of the {...@link CandidateSteps}
+ * class</li>
+ * <li>the pattern to match the candidate step that is configured in the
+ * annotation</li>
+ * <li>the alias patterns for the candidate step (optional)</li>
+ * <li>the method in the {...@link CandidateSteps} class</li>
  * </ul>
  * 
  * @author Mauro Talevi
@@ -64,38 +64,40 @@
 	public List<String> getAliasPatterns() {
 		return aliasPatterns;
 	}
-	
+
 	public Method getMethod() {
 		return method;
 	}
-	
-    public CandidateSteps getCandidateSteps() {
+
+	public CandidateSteps getCandidateSteps() {
 		return candidateSteps;
 	}
 
 	/**
-     * Method signature without "public void" prefix
-     * @return The method signature in String format
-     */
-    public String getMethodSignature() {
-        String methodSignature = method.toString();
-        return methodSignature.replaceFirst("public void ", "");
-    }
+	 * Method signature without "public void" prefix
+	 * 
+	 * @return The method signature in String format
+	 */
+	public String getMethodSignature() {
+		String methodSignature = method.toString();
+		return methodSignature.replaceFirst("public void ", "");
+	}
 
-    @Override
+	@Override
 	public String toString() {
 		StringBuffer sb = new StringBuffer();
 		sb.append("[Stepdoc pattern=").append(pattern).append(", aliases=")
-				.append(aliasPatterns).append(", method=").append(getMethodSignature())
-				.append(", candidateSteps=").append(candidateSteps.getClass()).append("]");
+				.append(aliasPatterns).append(", method=").append(
+						getMethodSignature()).append(", candidateSteps=")
+				.append(candidateSteps.getClass()).append("]");
 		return sb.toString();
 	}
 
 	public int compareTo(Stepdoc that) {
-        int compare = this.priority.compareTo(that.priority);
-        if (compare == 0) {
-            compare = this.pattern.compareTo(that.pattern);
-        }
-        return compare;
+		int compare = this.priority.compareTo(that.priority);
+		if (compare == 0) {
+			compare = this.pattern.compareTo(that.pattern);
+		}
+		return compare;
 	}
 }


To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Reply via email to