Title: [1478] trunk/core/jbehave-core/src/main/resources/style: Report scenario steps being executed in table examples.

Diff

Modified: trunk/core/jbehave-core/src/behaviour/java/org/jbehave/scenario/reporters/DelegatingScenarioReporterBehaviour.java (1477 => 1478)

--- trunk/core/jbehave-core/src/behaviour/java/org/jbehave/scenario/reporters/DelegatingScenarioReporterBehaviour.java	2009-12-27 16:09:42 UTC (rev 1477)
+++ trunk/core/jbehave-core/src/behaviour/java/org/jbehave/scenario/reporters/DelegatingScenarioReporterBehaviour.java	2009-12-27 16:49:30 UTC (rev 1478)
@@ -30,7 +30,7 @@
         delegator.successful("Given step 1.1");
         delegator.pending("When step 1.2");
         delegator.notPerformed("Then step 1.3");
-        delegator.beforeExamples(examplesTable);
+        delegator.beforeExamples(asList("Given step <one>", "Then step <two>"), examplesTable);
         delegator.example(examplesTable.getRow(0));
         delegator.afterExamples();
         delegator.afterScenario();
@@ -52,7 +52,7 @@
         inOrder.verify(delegate).successful("Given step 1.1");
         inOrder.verify(delegate).pending("When step 1.2");
         inOrder.verify(delegate).notPerformed("Then step 1.3");
-        inOrder.verify(delegate).beforeExamples(examplesTable);
+        inOrder.verify(delegate).beforeExamples(asList("Given step <one>", "Then step <two>"), examplesTable);
         inOrder.verify(delegate).example(examplesTable.getRow(0));
         inOrder.verify(delegate).afterExamples();
         inOrder.verify(delegate).afterScenario();

Modified: trunk/core/jbehave-core/src/behaviour/java/org/jbehave/scenario/reporters/PassSilentlyDecoratorBehaviour.java (1477 => 1478)

--- trunk/core/jbehave-core/src/behaviour/java/org/jbehave/scenario/reporters/PassSilentlyDecoratorBehaviour.java	2009-12-27 16:09:42 UTC (rev 1477)
+++ trunk/core/jbehave-core/src/behaviour/java/org/jbehave/scenario/reporters/PassSilentlyDecoratorBehaviour.java	2009-12-27 16:49:30 UTC (rev 1478)
@@ -40,7 +40,7 @@
         decorator.afterScenario();
         
         decorator.beforeScenario("My scenario 3");
-		decorator.beforeExamples(examplesTable);
+		decorator.beforeExamples(asList("Given step <one>", "Then step <two>"), examplesTable);
         decorator.successful("Given step 3.1");
         decorator.successful("When step 3.2");
         decorator.failed("Then step 3.3", anException);
@@ -74,7 +74,7 @@
         inOrder.verify(delegate).afterScenario();
         
         inOrder.verify(delegate).beforeScenario("My scenario 3");
-        inOrder.verify(delegate).beforeExamples(examplesTable);
+        inOrder.verify(delegate).beforeExamples(asList("Given step <one>", "Then step <two>"), examplesTable);
         inOrder.verify(delegate).successful("Given step 3.1");
         inOrder.verify(delegate).successful("When step 3.2");
         inOrder.verify(delegate).failed("Then step 3.3", anException);

Modified: trunk/core/jbehave-core/src/behaviour/java/org/jbehave/scenario/reporters/PrintStreamScenarioReporterBehaviour.java (1477 => 1478)

--- trunk/core/jbehave-core/src/behaviour/java/org/jbehave/scenario/reporters/PrintStreamScenarioReporterBehaviour.java	2009-12-27 16:09:42 UTC (rev 1477)
+++ trunk/core/jbehave-core/src/behaviour/java/org/jbehave/scenario/reporters/PrintStreamScenarioReporterBehaviour.java	2009-12-27 16:49:30 UTC (rev 1478)
@@ -43,15 +43,25 @@
         narrateAnInterestingStory(reporter);
 
         // Then
-        String expected = "An interesting story\n" + "(/path/to/story)\n" + "Scenario: I ask for a loan\n"
-                + "GivenScenarios: [/given/scenario1,/given/scenario2]\n" + "Given I have a balance of $50\n"
-                + "When I request $20\n" + "When I ask Liz for a loan of $100\n"
-                + "Then I should have a balance of $30 (PENDING)\n" + "Then I should have $20 (NOT PERFORMED)\n"
-                + "Then I don't return loan (FAILED)\n" + "Examples:\n\n" + "|money|to|\n" + "|$30|Mauro|\n"
+        String expected = "An interesting story\n" 
+                + "(/path/to/story)\n" 
+                + "Scenario: I ask for a loan\n"
+                + "GivenScenarios: [/given/scenario1,/given/scenario2]\n" 
+                + "Given I have a balance of $50\n"
+                + "When I request $20\n" 
+                + "When I ask Liz for a loan of $100\n"
+                + "Then I should have a balance of $30 (PENDING)\n" 
+                + "Then I should have $20 (NOT PERFORMED)\n"
+                + "Then I don't return loan (FAILED)\n" 
+                + "Examples:\n" 
+                + "Given money <money>\n"
+                + "Then I give it to <to>\n"
+                + "\n"
+                + "|money|to|\n" + "|$30|Mauro|\n"
                 + "|$50|Paul|\n" + "\n\n" // Examples table
-                + "\nExample: {to=Mauro, money=$30}\n" + "\nExample: {to=Paul, money=$50}\n" + "\n" // end
-                                                                                                    // of
-                                                                                                    // examples
+                + "\nExample: {to=Mauro, money=$30}\n" 
+                + "\nExample: {to=Paul, money=$50}\n" 
+                + "\n" // end of examples
                 + "\n\n"; // end of scenario and story
         ensureThatOutputIs(out, expected);
     }
@@ -82,7 +92,10 @@
                 + "<div class=\"step pending\">Then I should have a balance of $30 <span class=\"keyword pending\">(PENDING)</span></div>\n"
                 + "<div class=\"step notPerformed\">Then I should have $20 <span class=\"keyword notPerformed\">(NOT PERFORMED)</span></div>\n"
                 + "<div class=\"step failed\">Then I don't return loan <span class=\"keyword failed\">(FAILED)</span></div>\n"
-                + "<div class=\"examples\">\n" + "<h3>Examples:</h3>\n" + "<table>\n" + "<thead>\n"
+                + "<div class=\"examples\">\n" + "<h3>Examples:</h3>\n" 
+                + "<div class=\"step\">Given money &lt;money&gt;</div>\n"
+                + "<div class=\"step\">Then I give it to &lt;to&gt;</div>\n"
+                + "<table>\n" + "<thead>\n"
                 + "<tr>\n<th>money</th><th>to</th></tr>\n" + "</thead>\n" + "<tbody>\n"
                 + "<tr>\n<td>$30</td><td>Mauro</td></tr>\n" + "<tr>\n<td>$50</td><td>Paul</td></tr>\n" + "</tbody>\n"
                 + "</table>\n" + "\n<h3 class=\"example\">Example: {to=Mauro, money=$30}</h3>\n"
@@ -123,7 +136,10 @@
                 + "<div class=\"step pending\">Then I should have a balance of $30 <span class=\"keyword pending\">(PENDING)</span></div>\n"
                 + "<div class=\"step notPerformed\">Then I should have $20 <span class=\"keyword notPerformed\">(NOT PERFORMED)</span></div>\n"
                 + "<div class=\"step failed\">Then I don't return loan <span class=\"keyword failed\">(FAILED)</span></div>\n"
-                + "<div class=\"examples\">\n" + "<h3>Examples:</h3>\n" + "<table>\n" + "<thead>\n"
+                + "<div class=\"examples\">\n" + "<h3>Examples:</h3>\n" 
+                + "<div class=\"step\">Given money &lt;money&gt;</div>\n"
+                + "<div class=\"step\">Then I give it to &lt;to&gt;</div>\n"
+                + "<table>\n" + "<thead>\n"
                 + "<tr>\n<th>money</th><th>to</th></tr>\n" + "</thead>\n" + "<tbody>\n"
                 + "<tr>\n<td>$30</td><td>Mauro</td></tr>\n" + "<tr>\n<td>$50</td><td>Paul</td></tr>\n" + "</tbody>\n"
                 + "</table>\n" + "\n<h3 class=\"example\">Example: {to=Mauro, money=$30}</h3>\n"
@@ -157,7 +173,10 @@
                 + "<step outcome=\"pending\" keyword=\"PENDING\">Then I should have a balance of $30</step>\n"
                 + "<step outcome=\"notPerformed\" keyword=\"NOT PERFORMED\">Then I should have $20</step>\n"
                 + "<step outcome=\"failed\" keyword=\"FAILED\">Then I don&apos;t return loan</step>\n"
-                + "<examples keyword=\"Examples:\">\n" + "<parameters>\n"
+                + "<examples keyword=\"Examples:\">\n" 
+                + "<step>Given money &lt;money&gt;</step>\n"
+                + "<step>Then I give it to &lt;to&gt;</step>\n"
+                + "<parameters>\n"
                 + "<names><name>money</name><name>to</name></names>\n"
                 + "<values><value>$30</value><value>Mauro</value></values>\n"
                 + "<values><value>$50</value><value>Paul</value></values>\n" + "</parameters>\n"
@@ -182,7 +201,7 @@
         reporter.notPerformed("Then I should have $20");
         reporter.failed("Then I don't return loan", new Exception("Naughty me!"));
         ExamplesTable table = new ExamplesTable("|money|to|\n|$30|Mauro|\n|$50|Paul|\n");
-        reporter.beforeExamples(table);
+        reporter.beforeExamples(asList("Given money <money>", "Then I give it to <to>"), table);
         reporter.example(table.getRow(0));
         reporter.example(table.getRow(1));
         reporter.afterExamples();

Modified: trunk/core/jbehave-core/src/main/java/org/jbehave/scenario/ScenarioRunner.java (1477 => 1478)

--- trunk/core/jbehave-core/src/main/java/org/jbehave/scenario/ScenarioRunner.java	2009-12-27 16:09:42 UTC (rev 1477)
+++ trunk/core/jbehave-core/src/main/java/org/jbehave/scenario/ScenarioRunner.java	2009-12-27 16:49:30 UTC (rev 1478)
@@ -60,7 +60,7 @@
     		reporter.beforeScenario(scenario.getTitle());
         	runGivenScenarios(configuration, scenario, candidateSteps); // first run any given scenarios, if any
         	if ( isExamplesTableScenario(scenario) ){ // run examples table scenario
-        		runExamplesTableScenario(configuration, scenario, scenario.getTable(), candidateSteps);
+        		runExamplesTableScenario(configuration, scenario, candidateSteps);
         	} else { // run plain old scenario
             	runScenario(configuration, scenario, new HashMap<String, String>(), candidateSteps);        		
         	}
@@ -89,9 +89,9 @@
 	}
 
 	private void runExamplesTableScenario(Configuration configuration,
-			ScenarioDefinition scenario, ExamplesTable table,
-			CandidateSteps... candidateSteps) {
-		reporter.beforeExamples(table);
+			ScenarioDefinition scenario, CandidateSteps... candidateSteps) {
+		ExamplesTable table = scenario.getTable();
+        reporter.beforeExamples(scenario.getSteps(), table);
 		for (Map<String,String> tableRow : table.getRows() ) {
 			reporter.example(tableRow);
 			runScenario(configuration, scenario, tableRow, candidateSteps);

Modified: trunk/core/jbehave-core/src/main/java/org/jbehave/scenario/reporters/DelegatingScenarioReporter.java (1477 => 1478)

--- trunk/core/jbehave-core/src/main/java/org/jbehave/scenario/reporters/DelegatingScenarioReporter.java	2009-12-27 16:09:42 UTC (rev 1477)
+++ trunk/core/jbehave-core/src/main/java/org/jbehave/scenario/reporters/DelegatingScenarioReporter.java	2009-12-27 16:49:30 UTC (rev 1478)
@@ -2,6 +2,7 @@
 
 import static java.util.Arrays.asList;
 
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
@@ -74,9 +75,9 @@
         }
     }
 
-    public void beforeExamples(ExamplesTable table) {
+    public void beforeExamples(List<String> steps, ExamplesTable table) {
         for (ScenarioReporter reporter : delegates) {
-            reporter.beforeExamples(table);
+            reporter.beforeExamples(steps, table);
         }
     }
 
@@ -93,7 +94,7 @@
     }
 
     public void examplesTable(ExamplesTable table) {
-        beforeExamples(table);
+        beforeExamples(new ArrayList<String>(), table);
     }
 
     public void examplesTableRow(Map<String, String> tableRow) {

Modified: trunk/core/jbehave-core/src/main/java/org/jbehave/scenario/reporters/HtmlPrintStreamScenarioReporter.java (1477 => 1478)

--- trunk/core/jbehave-core/src/main/java/org/jbehave/scenario/reporters/HtmlPrintStreamScenarioReporter.java	2009-12-27 16:09:42 UTC (rev 1477)
+++ trunk/core/jbehave-core/src/main/java/org/jbehave/scenario/reporters/HtmlPrintStreamScenarioReporter.java	2009-12-27 16:49:30 UTC (rev 1478)
@@ -52,6 +52,7 @@
         patterns.setProperty("afterScenarioWithFailure", "<div class=\"scenario.failure\">{0}</div>\n</div>\n");
         patterns.setProperty("givenScenarios", "<div class=\"givenScenarios\">{0} {1}</div>\n");
         patterns.setProperty("beforeExamples", "<div class=\"examples\">\n<h3>{0}</h3>\n");
+        patterns.setProperty("examplesStep", "<div class=\"step\">{0}</div>\n");
         patterns.setProperty("afterExamples", "</div>\n");
         patterns.setProperty("examplesTableStart", "<table>\n");
         patterns.setProperty("examplesTableHeadStart", "<thead>\n<tr>\n");

Modified: trunk/core/jbehave-core/src/main/java/org/jbehave/scenario/reporters/PassSilentlyDecorator.java (1477 => 1478)

--- trunk/core/jbehave-core/src/main/java/org/jbehave/scenario/reporters/PassSilentlyDecorator.java	2009-12-27 16:09:42 UTC (rev 1477)
+++ trunk/core/jbehave-core/src/main/java/org/jbehave/scenario/reporters/PassSilentlyDecorator.java	2009-12-27 16:49:30 UTC (rev 1478)
@@ -125,10 +125,10 @@
         });
 	}
 	
-	public void beforeExamples(final ExamplesTable table) {
+	public void beforeExamples(final List<String> steps, final ExamplesTable table) {
         currentScenario.add(new Todo() {
             public void doNow() {
-                delegate.beforeExamples(table);
+                delegate.beforeExamples(steps, table);
             }
         });		
 	}
@@ -150,7 +150,7 @@
     }
 
     public void examplesTable(ExamplesTable table) {
-        beforeExamples(table);        
+        beforeExamples(new ArrayList<String>(), table);        
     }
 
     public void examplesTableRow(Map<String, String> tableRow) {

Modified: trunk/core/jbehave-core/src/main/java/org/jbehave/scenario/reporters/PrintStreamScenarioReporter.java (1477 => 1478)

--- trunk/core/jbehave-core/src/main/java/org/jbehave/scenario/reporters/PrintStreamScenarioReporter.java	2009-12-27 16:09:42 UTC (rev 1477)
+++ trunk/core/jbehave-core/src/main/java/org/jbehave/scenario/reporters/PrintStreamScenarioReporter.java	2009-12-27 16:49:30 UTC (rev 1478)
@@ -9,6 +9,7 @@
 import java.io.ByteArrayOutputStream;
 import java.io.PrintStream;
 import java.text.MessageFormat;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Locale;
@@ -167,8 +168,11 @@
         return out.toString();
     }
 
-    public void beforeExamples(ExamplesTable table) {
+    public void beforeExamples(List<String> steps, ExamplesTable table) {
         print(format("beforeExamples", "{0}\n", keywords.examplesTable()));
+        for (String step : steps) {
+            print(format("examplesStep", "{0}\n", step));
+        }
         print(format("examplesTableStart", "\n"));
         final List<Map<String, String>> rows = table.getRows();
         final List<String> headers = table.getHeaders();
@@ -198,7 +202,7 @@
     }
 
     public void examplesTable(ExamplesTable table) {
-        beforeExamples(table);        
+        beforeExamples(new ArrayList<String>(), table);        
     }
 
     public void examplesTableRow(Map<String, String> tableRow) {

Modified: trunk/core/jbehave-core/src/main/java/org/jbehave/scenario/reporters/ScenarioReporter.java (1477 => 1478)

--- trunk/core/jbehave-core/src/main/java/org/jbehave/scenario/reporters/ScenarioReporter.java	2009-12-27 16:09:42 UTC (rev 1477)
+++ trunk/core/jbehave-core/src/main/java/org/jbehave/scenario/reporters/ScenarioReporter.java	2009-12-27 16:49:30 UTC (rev 1478)
@@ -40,7 +40,7 @@
 	 */
 	void examplesTable(ExamplesTable table);
 
-	void beforeExamples(ExamplesTable table);
+	void beforeExamples(List<String> steps, ExamplesTable table);
 
     /**
      * @deprecated Use example(Map<String, String> )

Modified: trunk/core/jbehave-core/src/main/java/org/jbehave/scenario/reporters/StatisticsScenarioReporter.java (1477 => 1478)

--- trunk/core/jbehave-core/src/main/java/org/jbehave/scenario/reporters/StatisticsScenarioReporter.java	2009-12-27 16:09:42 UTC (rev 1477)
+++ trunk/core/jbehave-core/src/main/java/org/jbehave/scenario/reporters/StatisticsScenarioReporter.java	2009-12-27 16:49:30 UTC (rev 1478)
@@ -4,6 +4,7 @@
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -84,7 +85,7 @@
         }
     }
 
-    public void beforeExamples(ExamplesTable table) {
+    public void beforeExamples(List<String> steps, ExamplesTable table) {
     }
 
     public void example(Map<String, String> tableRow) {
@@ -95,7 +96,7 @@
     }
 
     public void examplesTable(ExamplesTable table) {
-        beforeExamples(table);
+        beforeExamples(new ArrayList<String>(), table);
     }
 
     public void examplesTableRow(Map<String, String> tableRow) {

Modified: trunk/core/jbehave-core/src/main/java/org/jbehave/scenario/reporters/StepFailureScenarioReporterDecorator.java (1477 => 1478)

--- trunk/core/jbehave-core/src/main/java/org/jbehave/scenario/reporters/StepFailureScenarioReporterDecorator.java	2009-12-27 16:09:42 UTC (rev 1477)
+++ trunk/core/jbehave-core/src/main/java/org/jbehave/scenario/reporters/StepFailureScenarioReporterDecorator.java	2009-12-27 16:49:30 UTC (rev 1478)
@@ -1,5 +1,6 @@
 package org.jbehave.scenario.reporters;
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
@@ -76,8 +77,8 @@
 		delegate.givenScenarios(givenScenarios);		
 	}
 
-	public void beforeExamples(ExamplesTable table) {
-		delegate.beforeExamples(table);
+	public void beforeExamples(List<String> steps, ExamplesTable table) {
+		delegate.beforeExamples(steps, table);
 	}
 
 	public void example(Map<String, String> tableRow) {
@@ -89,7 +90,7 @@
     }
 
     public void examplesTable(ExamplesTable table) {
-        beforeExamples(table);
+        beforeExamples(new ArrayList<String>(), table);
     }
 
     public void examplesTableRow(Map<String, String> tableRow) {

Modified: trunk/core/jbehave-core/src/main/java/org/jbehave/scenario/reporters/XmlPrintStreamScenarioReporter.java (1477 => 1478)

--- trunk/core/jbehave-core/src/main/java/org/jbehave/scenario/reporters/XmlPrintStreamScenarioReporter.java	2009-12-27 16:09:42 UTC (rev 1477)
+++ trunk/core/jbehave-core/src/main/java/org/jbehave/scenario/reporters/XmlPrintStreamScenarioReporter.java	2009-12-27 16:49:30 UTC (rev 1478)
@@ -51,6 +51,7 @@
         patterns.setProperty("afterScenarioWithFailure", "<failure>{0}</failure>\n</scenario>\n");
         patterns.setProperty("givenScenarios", "<givenScenarios keyword=\"{0}\"paths=\"{1}\"</givenScenarios>\n");
         patterns.setProperty("beforeExamples", "<examples keyword=\"{0}\">\n");
+        patterns.setProperty("examplesStep", "<step>{0}</step>\n");
         patterns.setProperty("afterExamples", "</examples>\n");
         patterns.setProperty("examplesTableStart", "<parameters>\n");
         patterns.setProperty("examplesTableHeadStart", "<names>");

Modified: trunk/core/jbehave-core/src/main/resources/style/jbehave-reports.css (1477 => 1478)

--- trunk/core/jbehave-core/src/main/resources/style/jbehave-reports.css	2009-12-27 16:09:42 UTC (rev 1477)
+++ trunk/core/jbehave-core/src/main/resources/style/jbehave-reports.css	2009-12-27 16:49:30 UTC (rev 1478)
@@ -167,6 +167,8 @@
 
 div.examples table {
   border: solid;
+  margin-top: 12px;
+  margin-left: 12px;
 }
 
 div.examples table th {


To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Reply via email to