Title: [1514] trunk/web: Updated to use 2.4 core snapshot

Diff

Modified: trunk/web/pom.xml (1513 => 1514)

--- trunk/web/pom.xml	2010-01-10 13:39:05 UTC (rev 1513)
+++ trunk/web/pom.xml	2010-01-10 13:39:52 UTC (rev 1514)
@@ -22,7 +22,7 @@
     <dependency>
       <groupId>org.jbehave</groupId>
       <artifactId>jbehave-core</artifactId>
-      <version>2.3</version>
+      <version>2.4-SNAPSHOT</version>
     </dependency>
      <dependency>
       <groupId>org.jmock</groupId>

Modified: trunk/web/web-runner/src/main/java/org/jbehave/web/runner/waffle/controllers/ScenarioController.java (1513 => 1514)

--- trunk/web/web-runner/src/main/java/org/jbehave/web/runner/waffle/controllers/ScenarioController.java	2010-01-10 13:39:05 UTC (rev 1513)
+++ trunk/web/web-runner/src/main/java/org/jbehave/web/runner/waffle/controllers/ScenarioController.java	2010-01-10 13:39:52 UTC (rev 1514)
@@ -4,6 +4,7 @@
 
 import java.io.ByteArrayOutputStream;
 import java.io.PrintStream;
+import java.util.Properties;
 
 import org.codehaus.waffle.action.annotation.ActionMethod;
 import org.codehaus.waffle.action.annotation.PRG;
@@ -12,6 +13,7 @@
 import org.jbehave.scenario.Configuration;
 import org.jbehave.scenario.PropertyBasedConfiguration;
 import org.jbehave.scenario.ScenarioRunner;
+import org.jbehave.scenario.definition.KeyWords;
 import org.jbehave.scenario.definition.StoryDefinition;
 import org.jbehave.scenario.parser.ScenarioParser;
 import org.jbehave.scenario.reporters.PrintStreamScenarioReporter;
@@ -36,11 +38,15 @@
 		this.scenarioRunner = scenarioRunner;
 		this.steps = steps;
 		this.outputStream = new ByteArrayOutputStream();
+        final Properties properties = new Properties();
+        properties.setProperty("beforeStory", "{0}\n");
+        final KeyWords keywords = configuration.keywords();
+        final boolean reportErrors = false;
 		this.configuration = new PropertyBasedConfiguration(configuration) {
 			@Override
 			public ScenarioReporter forReportingScenarios() {
 				return new PrintStreamScenarioReporter(new PrintStream(
-						outputStream));
+						outputStream), properties, keywords, reportErrors);
 			}
 		};
 		this.scenarioContext = new ScenarioContext();
@@ -67,7 +73,7 @@
 	}
 
 	private StoryDefinition storyDefinition() {
-		return scenarioParser.defineStoryFrom(scenarioContext.getInput());
+		return scenarioParser.defineStoryFrom(scenarioContext.getInput(), null);
 	}
 
 	public ScenarioContext getScenarioContext() {

Modified: trunk/web/web-runner/src/test/java/org/jbehave/web/runner/waffle/controllers/ScenarioControllerTest.java (1513 => 1514)

--- trunk/web/web-runner/src/test/java/org/jbehave/web/runner/waffle/controllers/ScenarioControllerTest.java	2010-01-10 13:39:05 UTC (rev 1513)
+++ trunk/web/web-runner/src/test/java/org/jbehave/web/runner/waffle/controllers/ScenarioControllerTest.java	2010-01-10 13:39:52 UTC (rev 1514)
@@ -32,12 +32,15 @@
 	@Test
 	public void canRunSuccessfulScenario(){
 		ScenarioController controller = new ScenarioController(MENU, configuration, parser, runner, new MySteps());
-		String scenarioInput = "Scenario: A simple test" + NL 
+		String scenarioInput = "Scenario: A simple test" + NL
 						+ NL
 						+ "Given a test" + NL
 						+ "When a test is executed" + NL
-						+ "Then a tester is a happy hopper"; 
-		String scenarioOutput = scenarioInput; // if successfully, input=output
+						+ "Then a tester is a happy hopper";
+		String scenarioOutput = "Scenario: A simple test" + NL
+						+ "Given a test" + NL
+						+ "When a test is executed" + NL
+						+ "Then a tester is a happy hopper";
 		controller.getScenarioContext().setInput(scenarioInput);
 		controller.run();
 		assertLinesMatch(scenarioOutput, controller.getScenarioContext().getOutput().trim());
@@ -48,21 +51,19 @@
 	@Test
 	public void canRunFailingScenario(){
 		ScenarioController controller = new ScenarioController(MENU, configuration, parser, runner, new MySteps());
-		String scenarioInput = "Scenario: A simple test" + NL 
-						+ NL
+		String scenarioInput = "Scenario: A simple test" + NL
 						+ "Given a test" + NL
 						+ "When a test fails" + NL
 						+ "Then a tester is a happy hopper"; 
-		String scenarioOutput = "Scenario: A simple test" + NL 
-						+ NL
+		String scenarioOutput = "Scenario: A simple test" + NL
 						+ "Given a test" + NL
 						+ "When a test fails (FAILED)" + NL
 						+ "Then a tester is a happy hopper (NOT PERFORMED)"; 
 		controller.getScenarioContext().setInput(scenarioInput);
 		controller.run();
 		assertLinesMatch(scenarioOutput, controller.getScenarioContext().getOutput().trim());
-		assertEquals(asList("Test failed"), controller.getScenarioContext().getFailureMessages());
-		assertTrue(controller.getScenarioContext().getFailureStackTrace().startsWith("java.lang.RuntimeException: Test failed"));
+		assertTrue(controller.getScenarioContext().getFailureMessages().contains("Test failed"));
+		assertTrue(controller.getScenarioContext().getFailureStackTrace().contains("java.lang.RuntimeException: Test failed"));
 	}
 
     @Test

Modified: trunk/web/web-selenium/src/test/java/org/jbehave/web/selenium/SeleniumStepsTest.java (1513 => 1514)

--- trunk/web/web-selenium/src/test/java/org/jbehave/web/selenium/SeleniumStepsTest.java	2010-01-10 13:39:05 UTC (rev 1513)
+++ trunk/web/web-selenium/src/test/java/org/jbehave/web/selenium/SeleniumStepsTest.java	2010-01-10 13:39:52 UTC (rev 1514)
@@ -31,11 +31,12 @@
 
 	@Test
 	public void canRunSuccessfulScenario() throws Throwable{
-		String scenarioInput = "Scenario: A simple web test" + NL 
+		String input = "Scenario: A simple web test" + NL
 						+ NL
 						+ "Given a test" + NL
 						+ "When a test is executed" + NL
-						+ "Then a tester is a happy hopper"; 
+						+ "Then a tester is a happy hopper";
+        String path = "/path/to/input";
 		mockery.checking(new Expectations(){{
 			exactly(3).of(selenium).setContext(with(any(String.class)));
 			one(selenium).start();
@@ -55,33 +56,10 @@
 			}
 			
 		};
-		runner.run(parser.defineStoryFrom(scenarioInput), configuration, steps);
+		runner.run(parser.defineStoryFrom(input, path), configuration, steps);
 	}
-	@Test
 
-	public void canRunSuccessfulScenario2() throws Throwable{
-		String scenarioInput = "Scenario: A simple web test" + NL
-						+ NL
-						+ "Given a test" + NL
-						+ "When a test is executed" + NL
-						+ "Then a tester is a happy hopper";
-		mockery.checking(new Expectations(){{
-			exactly(3).of(selenium).setContext(with(any(String.class)));
-			one(selenium).start();
-			one(selenium).close();
-			one(selenium).stop();
-		}});
-		Steps steps = new MySteps(selenium){
 
-			@Override
-			protected ConditionRunner createConditionRunner(Selenium selenium) {
-				return conditionRunner;
-			}
-
-		};
-		runner.run(parser.defineStoryFrom(scenarioInput), configuration, steps);
-	}
-
 	public static class MySteps extends SeleniumSteps {
 
         public MySteps() {


To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Reply via email to