[jbehave-dev] [jira] Resolved: (JBEHAVE-134) Extract CandidateSteps interface
[ http://jira.codehaus.org/browse/JBEHAVE-134?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Mauro Talevi resolved JBEHAVE-134. -- Resolution: Fixed Steps now implements CandidateSteps interface. > Extract CandidateSteps interface > > > Key: JBEHAVE-134 > URL: http://jira.codehaus.org/browse/JBEHAVE-134 > Project: JBehave > Issue Type: Improvement >Affects Versions: 2.0 >Reporter: Mauro Talevi >Assignee: Mauro Talevi > Fix For: 2.1 > > > Extract CandidateSteps interface from Steps class so to allow composition > over inheritance. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
[jbehave-dev] [jira] Resolved: (JBEHAVE-132) Support multiple test frameworks
[ http://jira.codehaus.org/browse/JBEHAVE-132?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Mauro Talevi resolved JBEHAVE-132. -- Resolution: Fixed > Support multiple test frameworks > > > Key: JBEHAVE-132 > URL: http://jira.codehaus.org/browse/JBEHAVE-132 > Project: JBehave > Issue Type: Improvement > Components: Core >Affects Versions: 2.0 >Reporter: Mauro Talevi >Assignee: Mauro Talevi > Fix For: 2.1 > > > Currently, we support JUnit 4.x as the test framework to run scenarios via > the @Test annotation. > We could easily extend support to multiple frameworks - including JUnit 3.8 > and TestNG. > The cleanest approach would be to rename abstract Scenario to JUnitScenario > and pull up a Scenario interface. > Since JUnit 4.x jar includes the 3.8 classes, support for JUnit 3 would > simply require extending TestCase and having a run method that starts with > "test". > -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
[jbehave-dev] [jira] Updated: (JBEHAVE-138) Bug recognising Step with content starting with Given, When, Then, And
[ http://jira.codehaus.org/browse/JBEHAVE-138?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Mauro Talevi updated JBEHAVE-138: - Affects Version/s: (was: 2.1) 2.0 Fix Version/s: 2.1 > Bug recognising Step with content starting with Given, When, Then, And > -- > > Key: JBEHAVE-138 > URL: http://jira.codehaus.org/browse/JBEHAVE-138 > Project: JBehave > Issue Type: Bug > Components: Core >Affects Versions: 2.0 >Reporter: Alexandre Martins > Fix For: 2.1 > > Attachments: PatternScenarioParser.java, > PatternScenarioParserBehaviour.java > > > When I have a scenario where one my steps contains words starting with Given, > When, Then, And, the scenario parser just ignores them. > Eg: Then the page should display name Anderson(Anderson starts with And, > so it doesn't recognise) > I've made a couple of changes on the PatternScenarioParser to fix it, and I > am sending to you. > Cheers > Alexandre Martins. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
[jbehave-dev] [jira] Resolved: (JBEHAVE-138) Bug recognising Step with content starting with Given, When, Then, And
[ http://jira.codehaus.org/browse/JBEHAVE-138?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Mauro Talevi resolved JBEHAVE-138. -- Resolution: Fixed Applied in trunk. Thanks! > Bug recognising Step with content starting with Given, When, Then, And > -- > > Key: JBEHAVE-138 > URL: http://jira.codehaus.org/browse/JBEHAVE-138 > Project: JBehave > Issue Type: Bug > Components: Core >Affects Versions: 2.0 >Reporter: Alexandre Martins > Fix For: 2.1 > > Attachments: PatternScenarioParser.java, > PatternScenarioParserBehaviour.java > > > When I have a scenario where one my steps contains words starting with Given, > When, Then, And, the scenario parser just ignores them. > Eg: Then the page should display name Anderson(Anderson starts with And, > so it doesn't recognise) > I've made a couple of changes on the PatternScenarioParser to fix it, and I > am sending to you. > Cheers > Alexandre Martins. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
[jbehave-scm] [980] trunk/jbehave-core/src/java/org/jbehave/scenario/parser: JBEHAVE-138: Applied patch from Alexandre Martins.
Title: [980] trunk/jbehave-core/src/java/org/jbehave/scenario/parser: JBEHAVE-138: Applied patch from Alexandre Martins. Revision 980 Author mauro Date 2008-10-16 16:44:22 -0500 (Thu, 16 Oct 2008) Log Message JBEHAVE-138: Applied patch from Alexandre Martins. Modified Paths trunk/jbehave-core/src/behaviour/org/jbehave/scenario/parser/PatternScenarioParserBehaviour.java trunk/jbehave-core/src/java/org/jbehave/scenario/parser/PatternScenarioParser.java Diff Modified: trunk/jbehave-core/src/behaviour/org/jbehave/scenario/parser/PatternScenarioParserBehaviour.java (979 => 980) --- trunk/jbehave-core/src/behaviour/org/jbehave/scenario/parser/PatternScenarioParserBehaviour.java 2008-10-16 20:08:03 UTC (rev 979) +++ trunk/jbehave-core/src/behaviour/org/jbehave/scenario/parser/PatternScenarioParserBehaviour.java 2008-10-16 21:44:22 UTC (rev 980) @@ -1,7 +1,7 @@ package org.jbehave.scenario.parser; import static org.hamcrest.CoreMatchers.equalTo; -import static org.jbehave.util.JUnit4Ensure.ensureThat; +import static org.jbehave.Ensure.ensureThat; import java.util.Arrays; import java.util.List; @@ -30,6 +30,22 @@ } @Test +public void shouldExtractGivensWhensAndThensFromSimpleScenariosContainingKeywordsAsPartOfTheContent() { +ScenarioParser parser = new PatternScenarioParser(new PropertyBasedConfiguration()); +StoryDefinition story = parser.defineStoryFrom( +"Given a scenario Givenly" + NL + +"When I parse it to Whenever" + NL + +"And I parse it to Anderson" + NL + +"Then I should get steps Thenact"); + +List steps = story.getScenarios().get(0).getSteps(); +ensureThat(steps.get(0), equalTo("Given a scenario Givenly")); +ensureThat(steps.get(1), equalTo("When I parse it to Whenever")); +ensureThat(steps.get(2), equalTo("And I parse it to Anderson")); +ensureThat(steps.get(3), equalTo("Then I should get steps Thenact")); +} + +@Test public void shouldExtractGivensWhensAndThensFromMultilineScenarios() { ScenarioParser parser = new PatternScenarioParser(new PropertyBasedConfiguration()); StoryDefinition story = parser.defineStoryFrom( Modified: trunk/jbehave-core/src/java/org/jbehave/scenario/parser/PatternScenarioParser.java (979 => 980) --- trunk/jbehave-core/src/java/org/jbehave/scenario/parser/PatternScenarioParser.java 2008-10-16 20:08:03 UTC (rev 979) +++ trunk/jbehave-core/src/java/org/jbehave/scenario/parser/PatternScenarioParser.java 2008-10-16 21:44:22 UTC (rev 980) @@ -96,20 +96,33 @@ } private String concatenateWithOr(String given, String when, String then, String[] others) { + return concatenateWithOr(false, given, when, then, others); +} + +private String concatenateWithSpaceOr(String given, String when, String then, String[] others) { +return concatenateWithOr(true, given, when, then, others); +} + +private String concatenateWithOr(boolean usingSpace, String given, String when, String then, String[] others) { StringBuilder builder = new StringBuilder(); -builder.append(given).append("|"); -builder.append(when).append("|"); -builder.append(then).append("|"); -return builder.append(concatenateWithOr(others)).toString(); +builder.append(given).append(usingSpace ? "\\s|" : "|"); +builder.append(when).append(usingSpace ? "\\s|" : "|"); +builder.append(then).append(usingSpace ? "\\s|" : "|"); +builder.append(usingSpace ? concatenateWithSpaceOr(others) : concatenateWithOr(others)); +return builder.toString(); } private String concatenateWithOr(String... keywords) { -return concatenateWithOr(new StringBuilder(), keywords); +return concatenateWithOr(false, new StringBuilder(), keywords); } + +private String concatenateWithSpaceOr(String... keywords) { + return concatenateWithOr(true, new StringBuilder(), keywords); +} -private String concatenateWithOr(StringBuilder builder, String[] keywords) { +private String concatenateWithOr(boolean usingSpace, StringBuilder builder, String[] keywords) { for (String other : keywords) { -builder.append(other).append("|"); +builder.append(other).append(usingSpace ? "\\s|" : "|"); } String result = builder.toString(); return result.substring(0, result.length() - 1); // chop off the last | @@ -118,7 +131,9 @@ private Pattern patternToPullOutSteps() { String givenWhenThen = concatenateWithOr(configuration.keywords().given(), configuration.keywords().when(), configuration.keywords().then(), configuration.keywords().others()); -return Pattern.compile("((" + givenWhenThen + ") (.|\\s)*?)\\s*(\\Z|" + givenWhenThen + "|" +String givenWhenThenSpaced = concatenateWithSpaceOr(configuratio
[jbehave-dev] @AfterSuccessfulScenario/@AfterUnsuccessfulScenario
Liz, just a minor afterthought - could these annotations be expressed equivalently as @AfterScenario(success="true/false") and if success is omitted then it defaults to @AfterScenario behaviour. Like? - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
[jbehave-dev] Re: @BeforeScenario & @AfterScenario, Ensure is back, apologies for broken build
Elizabeth Keogh wrote: Hi all, I've just checked in the @BeforeScenario and @AfterScenario stuff. This enables you to run miscellaneous "admin" tasks before and after any scenario. I recommend putting them in seperate Steps classes, so that they're easy to inject into any scenario which needs them. We suggest that Givens should still be used for setting up the context of scenarios. These steps are intended for things like initializing any test framework, setting up a production-like environment, providing logging info, etc.. I'm using them to close down all the windows in my Noughts and Crosses game. Had a look at this - very nice work Liz! :-) I don't want to mark this as "fixed" yet because our Ant build is broken following the PicoContainer and Spring work. Dan and I are about to Ivy the build anyway, which will help us resolve these dependencies. Everything else is working. Ant build fixed - Spring test was requiring commons-logging dependency. Goes to show yet again how useful moving to Ivy to provide transitive dependency management for Ant would be :-) Until then - I've also replaced junit jar with junit-dep jar now that we moved to specify hamcrest as an unbundled dependency. Keeping hamcrest bundled and unbundled could lead to unexpected classloader behaviour dependending on order in the classpath. Cheers - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
[jbehave-scm] [979] trunk/lib/build: Replaced junit bundled jar with junit-dep, which has hamcrest dependency unbundled.
Title: [979] trunk/lib/build: Replaced junit bundled jar with junit-dep, which has hamcrest dependency unbundled. Revision 979 Author mauro Date 2008-10-16 15:08:03 -0500 (Thu, 16 Oct 2008) Log Message Replaced junit bundled jar with junit-dep, which has hamcrest dependency unbundled. Added Paths trunk/lib/production/hamcrest-all-1.1.jar trunk/lib/production/junit-dep-4.4.jar Removed Paths trunk/lib/build/hamcrest-all-1.1.jar trunk/lib/production/junit-4.4.jar Diff Deleted: trunk/lib/build/hamcrest-all-1.1.jar (Binary files differ) Copied: trunk/lib/production/hamcrest-all-1.1.jar (from rev 975, trunk/lib/build/hamcrest-all-1.1.jar) (Binary files differ) Property changes: trunk/lib/production/hamcrest-all-1.1.jar Name: svn:mime-type + application/octet-stream Name: svn:mergeinfo + Deleted: trunk/lib/production/junit-4.4.jar (Binary files differ) Added: trunk/lib/production/junit-dep-4.4.jar (Binary files differ) Property changes on: trunk/lib/production/junit-dep-4.4.jar ___ Name: svn:mime-type + application/octet-stream To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email
[jbehave-scm] [978] trunk/lib/production/commons-logging-1.1.jar: Added dependency required by spring integration.
Title: [978] trunk/lib/production/commons-logging-1.1.jar: Added dependency required by spring integration. Revision 978 Author mauro Date 2008-10-16 15:04:46 -0500 (Thu, 16 Oct 2008) Log Message Added dependency required by spring integration. Added Paths trunk/lib/production/commons-logging-1.1.jar Diff Added: trunk/lib/production/commons-logging-1.1.jar (Binary files differ) Property changes on: trunk/lib/production/commons-logging-1.1.jar ___ Name: svn:mime-type + application/octet-stream To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email
[jbehave-scm] [977] trunk/jbehave-core/src/behaviour/org/jbehave/scenario/annotations/: Removed empty package.
Title: [977] trunk/jbehave-core/src/behaviour/org/jbehave/scenario/annotations/: Removed empty package. Revision 977 Author mauro Date 2008-10-16 14:58:55 -0500 (Thu, 16 Oct 2008) Log Message Removed empty package. Removed Paths trunk/jbehave-core/src/behaviour/org/jbehave/scenario/annotations/ Diff To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email
[jbehave-dev] Re: @BeforeScenario & @AfterScenario, Ensure is back, apologies for broken build
Elizabeth Keogh wrote: I don't want to mark this as "fixed" yet because our Ant build is broken following the PicoContainer and Spring work. Dan and I are about to Ivy the build anyway, which will help us resolve these dependencies. Everything else is working. Great - could we then remove the jars from svn once we have ivy in place for Ant? To the contributors: Once this is fixed, please could we make sure the Ant build runs before checking in ;) It would be useful if Ant actually provided a hint as to why it fails. It passes both in IDE and mvn. Cheers - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
[jbehave-scm] [976] trunk/pom.xml: Update junit dependencies to use unbundled hamcrest jar.
Title: [976] trunk/pom.xml: Update junit dependencies to use unbundled hamcrest jar. Revision 976 Author mauro Date 2008-10-16 13:59:39 -0500 (Thu, 16 Oct 2008) Log Message Update junit dependencies to use unbundled hamcrest jar. Modified Paths trunk/pom.xml Diff Modified: trunk/pom.xml (975 => 976) --- trunk/pom.xml 2008-10-16 10:10:08 UTC (rev 975) +++ trunk/pom.xml 2008-10-16 18:59:39 UTC (rev 976) @@ -20,10 +20,21 @@ junit -junit +junit-dep 4.4 + + +org.hamcrest +hamcrest-core + + +org.hamcrest +hamcrest-all +1.1 + + org.apache.ant ant @@ -56,9 +67,13 @@ junit - junit + junit-dep + org.hamcrest + hamcrest-all + + org.mockito mockito-all @@ -317,7 +332,7 @@ - To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email
[jbehave-dev] Hello lists
Hi all. The JBehave dev and user lists have been running for a long time, and I'm sure there are several long-time lurkers on the list as well as a few new faces popping up now that JBehave 2 is out. It would be great if you could send a short message introducing yourself to the list (long-time lurkers, new faces, dev team, spambots), and especially to let us know how you are finding JBehave 2 and where you would like it to go next. Cheers, Dan I'll start: My name is Dan, I'm a trouble-maker (they call it "consultant" but what do they know?) with a technology consultancy called ThoughtWorks, where I like to get involved with agile coaching, arcitecture, programming and hand-waving-at-conferences. I've been involved in IT for about 20 years and I'm realising more and more that getting people talking with each other is far more effective at getting good software delivered than any tooling or technology. For the past five years I've been banging on about Behaviour-Driven Development, which is really about getting people interacting and "getting the words right" so they can work together. It's also about defining when we are Done so we can get to the pub quicker (aka Beer-Driven Development). So who are you and how would you like to see JBehave evolve?
[jbehave-dev] @BeforeScenario & @AfterScenario, Ensure is back, apologies for broken build
Hi all, I've just checked in the @BeforeScenario and @AfterScenario stuff. This enables you to run miscellaneous "admin" tasks before and after any scenario. I recommend putting them in seperate Steps classes, so that they're easy to inject into any scenario which needs them. We suggest that Givens should still be used for setting up the context of scenarios. These steps are intended for things like initializing any test framework, setting up a production-like environment, providing logging info, etc.. I'm using them to close down all the windows in my Noughts and Crosses game. I don't want to mark this as "fixed" yet because our Ant build is broken following the PicoContainer and Spring work. Dan and I are about to Ivy the build anyway, which will help us resolve these dependencies. Everything else is working. I've also put back "Ensure" as some of us were using it elsewhere. To the contributors: Once this is fixed, please could we make sure the Ant build runs before checking in ;) Thanks! Liz. -- Elizabeth Keogh [EMAIL PROTECTED] [EMAIL PROTECTED] http://jbehave.org http://lizkeogh.com - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
[jbehave-scm] [975] trunk: [Liz] All the before/after scenario stuff now works.
Title: [975] trunk: [Liz] All the before/after scenario stuff now works. Revision 975 Author sirenian Date 2008-10-16 05:10:08 -0500 (Thu, 16 Oct 2008) Log Message [Liz] All the before/after scenario stuff now works. NB: Ant build is broken and probably has been for some versions; SpringContainerBehaviour also not working due to library dependencies. Dan and I are about to Ivy this build so it should be fixed within a day or so. Modified Paths trunk/examples/noughtsandcrosses/src/scenario/com/lunivore/noughtsandcrosses/PlayersCanHazTurns.java trunk/examples/noughtsandcrosses/src/scenario/com/lunivore/noughtsandcrosses/PlayersCanTakeTurns.java trunk/examples/noughtsandcrosses/src/scenario/com/lunivore/noughtsandcrosses/TheGridStartsEmpty.java trunk/examples/noughtsandcrosses/src/scenario/com/lunivore/noughtsandcrosses/ThreeInARowWins.java trunk/examples/noughtsandcrosses/src/scenario/com/lunivore/noughtsandcrosses/steps/GridSteps.java trunk/examples/noughtsandcrosses/src/scenario/com/lunivore/noughtsandcrosses/steps/LolCatzSteps.java trunk/jbehave-core/src/behaviour/org/jbehave/scenario/ScenarioRunnerBehaviour.java trunk/jbehave-core/src/behaviour/org/jbehave/scenario/steps/StepsBehaviour.java trunk/jbehave-core/src/behaviour/org/jbehave/scenario/steps/UnmatchedToPendingStepCreatorBehaviour.java trunk/jbehave-core/src/java/org/jbehave/scenario/ScenarioRunner.java trunk/jbehave-core/src/java/org/jbehave/scenario/steps/CandidateSteps.java trunk/jbehave-core/src/java/org/jbehave/scenario/steps/PendingStep.java trunk/jbehave-core/src/java/org/jbehave/scenario/steps/Steps.java trunk/jbehave-core/src/java/org/jbehave/scenario/steps/StepsConfiguration.java trunk/jbehave-core/src/java/org/jbehave/scenario/steps/UnmatchedToPendingStepCreator.java Added Paths trunk/.hgignore trunk/examples/noughtsandcrosses/src/scenario/com/lunivore/noughtsandcrosses/steps/BeforeAndAfterSteps.java trunk/examples/noughtsandcrosses/src/scenario/com/lunivore/noughtsandcrosses/util/ trunk/examples/noughtsandcrosses/src/scenario/com/lunivore/noughtsandcrosses/util/NoughtsAndCrossesScenario.java trunk/examples/noughtsandcrosses/src/scenario/com/lunivore/noughtsandcrosses/util/OAndXUniverse.java trunk/jbehave-core/src/behaviour/org/jbehave/scenario/annotations/ trunk/jbehave-core/src/java/org/jbehave/Ensure.java trunk/jbehave-core/src/java/org/jbehave/scenario/annotations/AfterScenario.java trunk/jbehave-core/src/java/org/jbehave/scenario/annotations/AfterSuccessfulScenario.java trunk/jbehave-core/src/java/org/jbehave/scenario/annotations/AfterUnsuccessfulScenario.java trunk/jbehave-core/src/java/org/jbehave/scenario/annotations/BeforeScenario.java trunk/jbehave-core/src/java/org/jbehave/scenario/errors/BeforeOrAfterScenarioException.java trunk/lib/build/hamcrest-all-1.1.jar trunk/lib/production/picocontainer-2.6.jar trunk/lib/production/picocontainer-script-core-2.0.jar trunk/lib/production/spring-2.5.5.jar Property Changed trunk/ Diff Property changes: trunk Name: svn:ignore - spike bin jbehave.iml classes delete_me dist workspace jbehave.iws build target-eclipse target .classpath .project working + spike bin jbehave.iml classes delete_me dist workspace jbehave.iws build target-eclipse target .classpath .project working .hg Added: trunk/.hgignore (0 => 975) --- trunk/.hgignore (rev 0) +++ trunk/.hgignore 2008-10-16 10:10:08 UTC (rev 975) @@ -0,0 +1,5 @@ +syntax: regexp +^bin +^working +.DS_Store +.svn Modified: trunk/examples/noughtsandcrosses/src/scenario/com/lunivore/noughtsandcrosses/PlayersCanHazTurns.java (974 => 975) --- trunk/examples/noughtsandcrosses/src/scenario/com/lunivore/noughtsandcrosses/PlayersCanHazTurns.java 2008-10-07 20:51:37 UTC (rev 974) +++ trunk/examples/noughtsandcrosses/src/scenario/com/lunivore/noughtsandcrosses/PlayersCanHazTurns.java 2008-10-16 10:10:08 UTC (rev 975) @@ -7,7 +7,9 @@ import org.jbehave.scenario.parser.ClasspathScenarioDefiner; import org.jbehave.scenario.parser.UnderscoredCamelCaseResolver; +import com.lunivore.noughtsandcrosses.steps.BeforeAndAfterSteps; import com.lunivore.noughtsandcrosses.steps.LolCatzSteps; +import com.lunivore.noughtsandcrosses.util.OAndXUniverse; /** * Checks that we can support scenarios written in other languages, @@ -20,6 +22,10 @@ } public PlayersCanHazTurns(final ClassLoader classLoader) { + this(classLoader, new OAndXUniverse()); +} + +public PlayersCanHazTurns(final ClassLoader classLoader, OAndXUniverse universe) { super(new MostUsefulConfiguration() { public KeyWords keywords() { return new KeyWords("I can haz", "Gief", "Wen", "Den", "And"); @@ -28,7 +34,7 @@ return new ClasspathScenarioDefiner(new UnderscoredCamelCaseResolver(), new PatternScenarioParser(this), classLoader); } -}, new LolCatzSteps()); +}, new LolCatzSteps(universe), new BeforeAndAfterSteps(