[jbehave-dev] [jira] Updated: (JBEHAVE-158) Generate StepDoc from annotated methods
[ http://jira.codehaus.org/browse/JBEHAVE-158?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Mauro Talevi updated JBEHAVE-158: - Description: Given a Steps instance, it'd be very useful to generate the list of candidate steps available to scenario writers. Something as simple as iterating through the annotated methods and writing out the list of the step patterns. was: Given a Steps instance, it'd be very useful to generate the list of candidate steps available to scenario writers. Something as simple as iterating through the annotated methods and writing out the list of the steps patterns. Summary: Generate StepDoc from annotated methods (was: Generate StepsDoc from annotated methods) Generate StepDoc from annotated methods --- Key: JBEHAVE-158 URL: http://jira.codehaus.org/browse/JBEHAVE-158 Project: JBehave Issue Type: New Feature Components: Core Affects Versions: 2.1 Reporter: Mauro Talevi Fix For: 2.2 Given a Steps instance, it'd be very useful to generate the list of candidate steps available to scenario writers. Something as simple as iterating through the annotated methods and writing out the list of the step patterns. -- 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] Assigned: (JBEHAVE-158) Generate StepDoc from annotated methods
[ http://jira.codehaus.org/browse/JBEHAVE-158?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Mauro Talevi reassigned JBEHAVE-158: Assignee: Mauro Talevi Generate StepDoc from annotated methods --- Key: JBEHAVE-158 URL: http://jira.codehaus.org/browse/JBEHAVE-158 Project: JBehave Issue Type: New Feature Components: Core Affects Versions: 2.1 Reporter: Mauro Talevi Assignee: Mauro Talevi Fix For: 2.2 Given a Steps instance, it'd be very useful to generate the list of candidate steps available to scenario writers. Something as simple as iterating through the annotated methods and writing out the list of the step patterns. -- 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] Work started: (JBEHAVE-158) Generate StepDoc from annotated methods
[ http://jira.codehaus.org/browse/JBEHAVE-158?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Work on JBEHAVE-158 started by Mauro Talevi. Generate StepDoc from annotated methods --- Key: JBEHAVE-158 URL: http://jira.codehaus.org/browse/JBEHAVE-158 Project: JBehave Issue Type: New Feature Components: Core Affects Versions: 2.1 Reporter: Mauro Talevi Assignee: Mauro Talevi Fix For: 2.2 Given a Steps instance, it'd be very useful to generate the list of candidate steps available to scenario writers. Something as simple as iterating through the annotated methods and writing out the list of the step patterns. -- 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] [1097] trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps: Added method to StepDoc.
Title: [1097] trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps: Added method to StepDoc. Revision 1097 Author mauro Date 2009-02-22 06:40:48 -0600 (Sun, 22 Feb 2009) Log Message Added method to StepDoc. Modified Paths trunk/core/jbehave-core/src/behaviour/org/jbehave/scenario/steps/StepDocGeneratorBehaviour.java trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/DefaultStepDocGenerator.java trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/StepDoc.java Diff Modified: trunk/core/jbehave-core/src/behaviour/org/jbehave/scenario/steps/StepDocGeneratorBehaviour.java (1096 => 1097) --- trunk/core/jbehave-core/src/behaviour/org/jbehave/scenario/steps/StepDocGeneratorBehaviour.java 2009-02-22 12:02:09 UTC (rev 1096) +++ trunk/core/jbehave-core/src/behaviour/org/jbehave/scenario/steps/StepDocGeneratorBehaviour.java 2009-02-22 12:40:48 UTC (rev 1097) @@ -17,10 +17,13 @@ ListStepDoc stepdocs = generator.generate(steps.getClass()); ensureThat(stepdocs.get(0).getPattern(), equalTo(a given)); ensureThat(stepdocs.get(0).getAliasPatterns(), equalTo(asList(a given alias, another given alias))); +ensureThat(stepdocs.get(0).getMethod().getName(), equalTo(given)); ensureThat(stepdocs.get(1).getPattern(), equalTo(a when)); ensureThat(stepdocs.get(1).getAliasPatterns(), equalTo(asList(a when alias, another when alias))); +ensureThat(stepdocs.get(1).getMethod().getName(), equalTo(when)); ensureThat(stepdocs.get(2).getPattern(), equalTo(a then)); ensureThat(stepdocs.get(2).getAliasPatterns(), equalTo(asList(a then alias, another then alias))); +ensureThat(stepdocs.get(2).getMethod().getName(), equalTo(then)); } public static class MySteps extends Steps { Modified: trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/DefaultStepDocGenerator.java (1096 => 1097) --- trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/DefaultStepDocGenerator.java 2009-02-22 12:02:09 UTC (rev 1096) +++ trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/DefaultStepDocGenerator.java 2009-02-22 12:40:48 UTC (rev 1097) @@ -17,15 +17,15 @@ for (Method method : stepsClass.getMethods()) { if (method.isAnnotationPresent(Given.class)) { stepdocs.add(new StepDoc(Given.class, method.getAnnotation(Given.class).value(), - aliases(method))); + aliases(method), method)); } if (method.isAnnotationPresent(When.class)) { stepdocs.add(new StepDoc(When.class, method.getAnnotation(When.class).value(), - aliases(method))); + aliases(method), method)); } if (method.isAnnotationPresent(Then.class)) { stepdocs.add(new StepDoc(Then.class, method.getAnnotation(Then.class).value(), - aliases(method))); + aliases(method), method)); } } Collections.sort(stepdocs); Modified: trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/StepDoc.java (1096 => 1097) --- trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/StepDoc.java 2009-02-22 12:02:09 UTC (rev 1096) +++ trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/StepDoc.java 2009-02-22 12:40:48 UTC (rev 1097) @@ -3,6 +3,7 @@ import static java.util.Arrays.asList; import java.lang.annotation.Annotation; +import java.lang.reflect.Method; import java.util.List; import org.jbehave.scenario.annotations.Given; @@ -13,14 +14,16 @@ private final Class? extends Annotation annotation; private final String pattern; - private final String[] aliasPatterns; + private final ListString aliasPatterns; + private final Method method; private Integer priority = 0; public StepDoc(Class? extends Annotation annotation, String pattern, - String[] aliasPatterns) { + String[] aliasPatterns, Method method) { this.annotation = annotation; this.pattern = pattern; - this.aliasPatterns = aliasPatterns; + this.aliasPatterns = asList(aliasPatterns); + this.method = method; assignPriority(); } @@ -44,14 +47,18 @@ } public ListString getAliasPatterns() { - return asList(aliasPatterns); + return aliasPatterns; } + + public Method getMethod() { + return method; + } @Override public String toString() { StringBuffer sb = new StringBuffer(); sb.append([StepDoc pattern=).append(pattern).append(, aliases=) -.append(asList(aliasPatterns)).append(]); +.append(aliasPatterns).append(, method=).append(method).append(]); return sb.toString(); } To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email
[jbehave-scm] [1098] trunk/core/examples/trader: JBEHAVE-158: Added StepDocReporter and Ant/Maven integration.
Title: [1098] trunk/core/examples/trader: JBEHAVE-158: Added StepDocReporter and Ant/Maven integration. Revision 1098 Author mauro Date 2009-02-22 07:21:51 -0600 (Sun, 22 Feb 2009) Log Message JBEHAVE-158: Added StepDocReporter and Ant/Maven integration. Modified Paths trunk/core/examples/trader/build.xml trunk/core/examples/trader/pom.xml trunk/core/jbehave-ant/src/main/java/org/jbehave/ant/ScenarioRunnerTask.java trunk/core/jbehave-core/src/java/org/jbehave/scenario/AbstractScenario.java trunk/core/jbehave-core/src/java/org/jbehave/scenario/JUnitScenario.java trunk/core/jbehave-core/src/java/org/jbehave/scenario/RunnableScenario.java trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/DefaultStepDocGenerator.java trunk/core/jbehave-maven-plugin/src/main/java/org/jbehave/mojo/ScenarioRunnerMojo.java Added Paths trunk/core/jbehave-ant/src/main/java/org/jbehave/ant/StepdocTask.java trunk/core/jbehave-core/src/java/org/jbehave/scenario/reporters/PrintStreamStepDocReporter.java trunk/core/jbehave-core/src/java/org/jbehave/scenario/reporters/StepDocReporter.java trunk/core/jbehave-maven-plugin/src/main/java/org/jbehave/mojo/StepdocMojo.java Diff Modified: trunk/core/examples/trader/build.xml (1097 => 1098) --- trunk/core/examples/trader/build.xml 2009-02-22 12:40:48 UTC (rev 1097) +++ trunk/core/examples/trader/build.xml 2009-02-22 13:21:51 UTC (rev 1098) @@ -3,7 +3,7 @@ Note: Use of artifact:dependencies/ requires ../../lib/build/maven-ant-tasks-2.0.9.jar in $ANT_HOME/lib -- -project name=trader default=run +project name=trader default=run-scenario xmlns:artifact=antlib:org.apache.maven.artifact.ant artifact:dependencies pathId=dependency.classpath @@ -35,7 +35,7 @@ /javac /target - target name=run depends=compile + target name=run-scenario depends=compile property name=dependency.classpath refid=dependency.classpath / path id=scenario.classpath pathelement location=target/classes / @@ -47,4 +47,16 @@ scenarioExcludes=**/*Steps.java skip=false / /target + target name=stepdoc depends=compile +property name=dependency.classpath refid=dependency.classpath / +path id=scenario.classpath + pathelement location=target/classes / + pathelement path=${dependency.classpath} / +/path +taskdef name=stepdoc classname=org.jbehave.ant.StepdocTask + classpathref=scenario.classpath / +stepdoc scenarioIncludes=org/jbehave/examples/trader/scenarios/*.java + scenarioExcludes=**/*Steps.java skip=false / + /target + /project \ No newline at end of file Modified: trunk/core/examples/trader/pom.xml (1097 => 1098) --- trunk/core/examples/trader/pom.xml 2009-02-22 12:40:48 UTC (rev 1097) +++ trunk/core/examples/trader/pom.xml 2009-02-22 13:21:51 UTC (rev 1098) @@ -36,12 +36,28 @@ scenarioExcludes scenarioExclude**/*Steps.java/scenarioExclude /scenarioExcludes - skiptrue/skip + skipfalse/skip /configuration goals goalrun-scenarios/goal /goals /execution + execution +idstepdoc/id +phaseintegration-test/phase +configuration + scenarioIncludes +scenarioIncludeorg/jbehave/examples/trader/scenarios/*.java/scenarioInclude + /scenarioIncludes + scenarioExcludes +scenarioExclude**/*Steps.java/scenarioExclude + /scenarioExcludes + skipfalse/skip +/configuration +goals + goalstepdoc/goal +/goals + /execution /executions /plugin plugin @@ -55,17 +71,29 @@ tasks taskdef name=scenarioRunner classname=org.jbehave.ant.ScenarioRunnerTask classpathref=maven.runtime.classpath / scenarioRunner scenarioIncludes=org/jbehave/examples/trader/scenarios/*.java - scenarioExcludes=**/*Steps.java skip=false / + scenarioExcludes=**/*Steps.java skip=true / /tasks /configuration goals goalrun/goal /goals /execution + execution +idstepdoc-via-ant/id +phaseintegration-test/phase +configuration + tasks +taskdef name=stepdoc classname=org.jbehave.ant.StepdocTask classpathref=maven.runtime.classpath / +stepdoc scenarioIncludes=org/jbehave/examples/trader/scenarios/*.java + scenarioExcludes=**/*Steps.java skip=true / + /tasks +/configuration +goals + goalrun/goal +/goals + /execution /executions /plugin - - /plugins /build /project \ No newline at end of file Modified:
[jbehave-scm] [1099] trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/DefaultStepDocGenerator.java: Removed empty method.
Title: [1099] trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/DefaultStepDocGenerator.java: Removed empty method. Revision 1099 Author mauro Date 2009-02-22 07:22:55 -0600 (Sun, 22 Feb 2009) Log Message Removed empty method. Modified Paths trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/DefaultStepDocGenerator.java Diff Modified: trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/DefaultStepDocGenerator.java (1098 => 1099) --- trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/DefaultStepDocGenerator.java 2009-02-22 13:21:51 UTC (rev 1098) +++ trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/DefaultStepDocGenerator.java 2009-02-22 13:22:55 UTC (rev 1099) @@ -1,6 +1,5 @@ package org.jbehave.scenario.steps; -import java.io.OutputStream; import java.lang.reflect.Method; import java.util.Collections; import java.util.LinkedList; @@ -40,10 +39,4 @@ return new String[]{}; } - public void reportTo(ListStepDoc stepdocs, OutputStream outputStream) { - // TODO Auto-generated method stub - - } - - } To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email
[jbehave-scm] [1100] trunk/core/jbehave-ant/src/main/java/org/jbehave/ant: Pulled up stepdoc generation method to RunnableScenario to avoid duplicaition in Ant/Maven integration and to allow standard
Title: [1100] trunk/core/jbehave-ant/src/main/java/org/jbehave/ant: Pulled up stepdoc generation method to RunnableScenario to avoid duplicaition in Ant/Maven integration and to allow standard JBehave configuration. Revision 1100 Author mauro Date 2009-02-22 07:35:52 -0600 (Sun, 22 Feb 2009) Log Message Pulled up stepdoc generation method to RunnableScenario to avoid duplicaition in Ant/Maven integration and to allow standard JBehave configuration. Modified Paths trunk/core/jbehave-ant/src/main/java/org/jbehave/ant/StepdocTask.java trunk/core/jbehave-core/src/behaviour/org/jbehave/scenario/ScenarioBehaviour.java trunk/core/jbehave-core/src/java/org/jbehave/scenario/AbstractScenario.java trunk/core/jbehave-core/src/java/org/jbehave/scenario/Configuration.java trunk/core/jbehave-core/src/java/org/jbehave/scenario/JUnitScenario.java trunk/core/jbehave-core/src/java/org/jbehave/scenario/MostUsefulConfiguration.java trunk/core/jbehave-core/src/java/org/jbehave/scenario/PropertyBasedConfiguration.java trunk/core/jbehave-core/src/java/org/jbehave/scenario/RunnableScenario.java trunk/core/jbehave-maven-plugin/src/main/java/org/jbehave/mojo/StepdocMojo.java Diff Modified: trunk/core/jbehave-ant/src/main/java/org/jbehave/ant/StepdocTask.java (1099 => 1100) --- trunk/core/jbehave-ant/src/main/java/org/jbehave/ant/StepdocTask.java 2009-02-22 13:22:55 UTC (rev 1099) +++ trunk/core/jbehave-ant/src/main/java/org/jbehave/ant/StepdocTask.java 2009-02-22 13:35:52 UTC (rev 1100) @@ -3,16 +3,8 @@ import static org.apache.tools.ant.Project.MSG_INFO; import static org.apache.tools.ant.Project.MSG_WARN; -import java.util.List; - import org.apache.tools.ant.BuildException; import org.jbehave.scenario.RunnableScenario; -import org.jbehave.scenario.reporters.PrintStreamStepDocReporter; -import org.jbehave.scenario.reporters.StepDocReporter; -import org.jbehave.scenario.steps.CandidateSteps; -import org.jbehave.scenario.steps.DefaultStepDocGenerator; -import org.jbehave.scenario.steps.StepDoc; -import org.jbehave.scenario.steps.StepDocGenerator; /** * Ant task that generate stepdocs @@ -30,9 +22,6 @@ */ private boolean ignoreFailure = false; - private StepDocGenerator generator = new DefaultStepDocGenerator(); - private StepDocReporter reporter = new PrintStreamStepDocReporter(); - public void execute() throws BuildException { if (skip) { log(Skipped running scenarios, MSG_INFO); @@ -42,10 +31,7 @@ String scenarioName = scenario.getClass().getName(); try { log(Generating stepdoc for + scenarioName); -for (CandidateSteps steps : scenario.getSteps()) { - ListStepDoc stepdocs = generator.generate(steps.getClass()); - reporter.report(stepdocs); -} +scenario.generateStepdoc(); } catch (Throwable e) { String message = Failed to generate stepdoc for + scenarioName; if (ignoreFailure) { Modified: trunk/core/jbehave-core/src/behaviour/org/jbehave/scenario/ScenarioBehaviour.java (1099 => 1100) --- trunk/core/jbehave-core/src/behaviour/org/jbehave/scenario/ScenarioBehaviour.java 2009-02-22 13:22:55 UTC (rev 1099) +++ trunk/core/jbehave-core/src/behaviour/org/jbehave/scenario/ScenarioBehaviour.java 2009-02-22 13:35:52 UTC (rev 1100) @@ -13,8 +13,10 @@ import org.jbehave.scenario.errors.PendingErrorStrategy; import org.jbehave.scenario.parser.ScenarioDefiner; import org.jbehave.scenario.reporters.ScenarioReporter; +import org.jbehave.scenario.reporters.StepDocReporter; import org.jbehave.scenario.steps.CandidateSteps; import org.jbehave.scenario.steps.StepCreator; +import org.jbehave.scenario.steps.StepDocGenerator; import org.jbehave.scenario.steps.Steps; import org.junit.Test; @@ -64,6 +66,10 @@ public ScenarioReporter forReportingScenarios() { return null; } public KeyWords keywords() { return null; } + + public StepDocGenerator forGeneratingStepdoc() { return null; } + + public StepDocReporter forReportingStepdoc() { return null; } } } Modified: trunk/core/jbehave-core/src/java/org/jbehave/scenario/AbstractScenario.java (1099 => 1100) --- trunk/core/jbehave-core/src/java/org/jbehave/scenario/AbstractScenario.java 2009-02-22 13:22:55 UTC (rev 1099) +++ trunk/core/jbehave-core/src/java/org/jbehave/scenario/AbstractScenario.java 2009-02-22 13:35:52 UTC (rev 1100) @@ -8,7 +8,10 @@ import org.jbehave.scenario.definition.KeyWords; import org.jbehave.scenario.definition.StoryDefinition; import org.jbehave.scenario.parser.ScenarioNameResolver; +import org.jbehave.scenario.reporters.StepDocReporter; import org.jbehave.scenario.steps.CandidateSteps; +import org.jbehave.scenario.steps.StepDoc; +import org.jbehave.scenario.steps.StepDocGenerator; /** * p @@ -80,4 +83,13 @@ return candidateSteps; } + public void generateStepdoc(){ + StepDocGenerator generator = configuration.forGeneratingStepdoc(); + for ( CandidateSteps steps : candidateSteps ){ + ListStepDoc stepdocs =
[jbehave-scm] [1104] trunk/core/jbehave-core/src/java/org/jbehave/scenario: Better formatting of stepdoc report, which now includes methods by default.
Title: [1104] trunk/core/jbehave-core/src/java/org/jbehave/scenario: Better formatting of stepdoc report, which now includes methods by default. Revision 1104 Author mauro Date 2009-02-22 07:54:27 -0600 (Sun, 22 Feb 2009) Log Message Better formatting of stepdoc report, which now includes methods by default. Modified Paths trunk/core/jbehave-core/src/behaviour/org/jbehave/scenario/steps/StepdocGeneratorBehaviour.java trunk/core/jbehave-core/src/java/org/jbehave/scenario/Configuration.java trunk/core/jbehave-core/src/java/org/jbehave/scenario/MostUsefulConfiguration.java trunk/core/jbehave-core/src/java/org/jbehave/scenario/reporters/PrintStreamStepdocReporter.java Added Paths trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/DefaultStepdocGenerator.java Removed Paths trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/DefaultStepdoc2Generator.java Diff Modified: trunk/core/jbehave-core/src/behaviour/org/jbehave/scenario/steps/StepdocGeneratorBehaviour.java (1103 => 1104) --- trunk/core/jbehave-core/src/behaviour/org/jbehave/scenario/steps/StepdocGeneratorBehaviour.java 2009-02-22 13:42:43 UTC (rev 1103) +++ trunk/core/jbehave-core/src/behaviour/org/jbehave/scenario/steps/StepdocGeneratorBehaviour.java 2009-02-22 13:54:27 UTC (rev 1104) @@ -12,7 +12,7 @@ @Test public void shouldGenerateStepdocsInPriorityOrder() { -StepdocGenerator generator = new DefaultStepdoc2Generator(); +StepdocGenerator generator = new DefaultStepdocGenerator(); MySteps steps = new MySteps(); ListStepdoc stepdocs = generator.generate(steps.getClass()); ensureThat(stepdocs.get(0).getPattern(), equalTo(a given)); Modified: trunk/core/jbehave-core/src/java/org/jbehave/scenario/Configuration.java (1103 => 1104) --- trunk/core/jbehave-core/src/java/org/jbehave/scenario/Configuration.java 2009-02-22 13:42:43 UTC (rev 1103) +++ trunk/core/jbehave-core/src/java/org/jbehave/scenario/Configuration.java 2009-02-22 13:54:27 UTC (rev 1104) @@ -22,6 +22,7 @@ * is provided. * * @author Elizabeth Keogh + * @author Mauro Talevi */ public interface Configuration { Modified: trunk/core/jbehave-core/src/java/org/jbehave/scenario/MostUsefulConfiguration.java (1103 => 1104) --- trunk/core/jbehave-core/src/java/org/jbehave/scenario/MostUsefulConfiguration.java 2009-02-22 13:42:43 UTC (rev 1103) +++ trunk/core/jbehave-core/src/java/org/jbehave/scenario/MostUsefulConfiguration.java 2009-02-22 13:54:27 UTC (rev 1104) @@ -12,7 +12,7 @@ import org.jbehave.scenario.reporters.PrintStreamStepdocReporter; import org.jbehave.scenario.reporters.ScenarioReporter; import org.jbehave.scenario.reporters.StepdocReporter; -import org.jbehave.scenario.steps.DefaultStepdoc2Generator; +import org.jbehave.scenario.steps.DefaultStepdocGenerator; import org.jbehave.scenario.steps.StepCreator; import org.jbehave.scenario.steps.StepdocGenerator; import org.jbehave.scenario.steps.UnmatchedToPendingStepCreator; @@ -86,12 +86,18 @@ return new ScenarioGivenWhenThenAnd(); } +/** + * Generates stepdocs + */ public StepdocGenerator forGeneratingStepdoc() { - return new DefaultStepdoc2Generator(); + return new DefaultStepdocGenerator(); } + /** + * Reports stepdocs to System.out + */ public StepdocReporter forReportingStepdoc() { - return new PrintStreamStepdocReporter(); + return new PrintStreamStepdocReporter(true); } } Modified: trunk/core/jbehave-core/src/java/org/jbehave/scenario/reporters/PrintStreamStepdocReporter.java (1103 => 1104) --- trunk/core/jbehave-core/src/java/org/jbehave/scenario/reporters/PrintStreamStepdocReporter.java 2009-02-22 13:42:43 UTC (rev 1103) +++ trunk/core/jbehave-core/src/java/org/jbehave/scenario/reporters/PrintStreamStepdocReporter.java 2009-02-22 13:54:27 UTC (rev 1104) @@ -1,5 +1,7 @@ package org.jbehave.scenario.reporters; +import static java.text.MessageFormat.format; + import java.io.PrintStream; import java.util.List; @@ -12,6 +14,9 @@ */ public class PrintStreamStepdocReporter implements StepdocReporter { + private static final String STEP = Step: {0} {1}; + private static final String ALIASES = Aliases: {0}; + private static final String METHOD = Method: {0}; private final PrintStream output; private final boolean reportMethods; @@ -19,6 +24,10 @@ this(System.out); } + public PrintStreamStepdocReporter(boolean reportMethods) { + this(System.out, reportMethods); + } + public PrintStreamStepdocReporter(PrintStream output) { this(output, false); } @@ -30,13 +39,12 @@ public void report(ListStepdoc stepdocs) { for (Stepdoc stepdoc : stepdocs) { - output.println(stepdoc.getAnnotation().getSimpleName() + - + stepdoc.getPattern()); + output.println(format(STEP, stepdoc.getAnnotation().getSimpleName(), stepdoc.getPattern())); if (stepdoc.getAliasPatterns().size() 0) { -output.println(Aliases: +
[jbehave-scm] [1106] trunk/web/web-waffle/src/main/webapp/ftl/scenario: Added view enum to stepdoc context to toggle between views.
Title: [1106] trunk/web/web-waffle/src/main/webapp/ftl/scenario: Added view enum to stepdoc context to toggle between views. Revision 1106 Author mauro Date 2009-02-22 11:26:01 -0600 (Sun, 22 Feb 2009) Log Message Added view enum to stepdoc context to toggle between views. Modified Paths trunk/web/web-waffle/src/main/java/org/jbehave/web/waffle/controllers/StepdocContext.java trunk/web/web-waffle/src/main/java/org/jbehave/web/waffle/controllers/StepdocController.java trunk/web/web-waffle/src/main/webapp/ftl/scenario/stepdoc.ftl Diff Modified: trunk/web/web-waffle/src/main/java/org/jbehave/web/waffle/controllers/StepdocContext.java (1105 => 1106) --- trunk/web/web-waffle/src/main/java/org/jbehave/web/waffle/controllers/StepdocContext.java 2009-02-22 15:10:29 UTC (rev 1105) +++ trunk/web/web-waffle/src/main/java/org/jbehave/web/waffle/controllers/StepdocContext.java 2009-02-22 17:26:01 UTC (rev 1106) @@ -1,6 +1,7 @@ package org.jbehave.web.waffle.controllers; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import org.apache.commons.lang.builder.ToStringBuilder; @@ -8,9 +9,11 @@ public class StepdocContext { + public enum View { SIMPLE, METHODS } + private ListStepdoc stepdocs = new ArrayListStepdoc(); - private boolean methodsShown = false; - + private View view = View.SIMPLE; + public StepdocContext() { } @@ -26,14 +29,18 @@ this.stepdocs.clear(); } - public boolean isMethodsShown() { - return methodsShown; + public ListView getViews(){ + return Arrays.asList(View.values()); } + + public View getView() { + return view; + } - public void setMethodsShown(boolean methodsShown) { - this.methodsShown = methodsShown; + public void setView(View view) { + this.view = view; } - + @Override public String toString() { return ToStringBuilder.reflectionToString(this); Modified: trunk/web/web-waffle/src/main/java/org/jbehave/web/waffle/controllers/StepdocController.java (1105 => 1106) --- trunk/web/web-waffle/src/main/java/org/jbehave/web/waffle/controllers/StepdocController.java 2009-02-22 15:10:29 UTC (rev 1105) +++ trunk/web/web-waffle/src/main/java/org/jbehave/web/waffle/controllers/StepdocController.java 2009-02-22 17:26:01 UTC (rev 1106) @@ -27,6 +27,11 @@ stepdocContext.addStepdocs(stepdocGenerator.generate(steps.getClass())); } + @ActionMethod + public void toggle() { + // used to toggle context view + } + public StepdocContext getStepdocContext() { return stepdocContext; } Modified: trunk/web/web-waffle/src/main/webapp/ftl/scenario/stepdoc.ftl (1105 => 1106) --- trunk/web/web-waffle/src/main/webapp/ftl/scenario/stepdoc.ftl 2009-02-22 15:10:29 UTC (rev 1105) +++ trunk/web/web-waffle/src/main/webapp/ftl/scenario/stepdoc.ftl 2009-02-22 17:26:01 UTC (rev 1106) @@ -9,13 +9,17 @@ div id=content form action="" - #assign stepdocs = stepdocContext.stepdocs / - #assign methodsShown = stepdocContext.methodsShown / + #assign stepdocs = stepdocContext.stepdocs / + #assign view = stepdocContext.view / #if (stepdocs.size() 0) div id=stepdocs fieldset legend@i.messageFor stepdocs Stepdocs//legend p + @w.selectSingle stepdocContext.view w.asNameableValues(stepdocContext.getViews(),name(),name()) stepdocContext.getView() //td/tr + a updateView Update View//a + /p + p pre class=brush: plain #list stepdocs as stepdoc ${stepdoc.annotation.simpleName} ${stepdoc.pattern} @@ -25,7 +29,7 @@ ${alias} /#list /#if - #if (methodsShown) + #if (view == METHODS) ${stepdoc.method} /#if /#list To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email
[jbehave-dev] [jira] Assigned: (JBEHAVE-133) Add lightweight container support for steps
[ http://jira.codehaus.org/browse/JBEHAVE-133?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Mauro Talevi reassigned JBEHAVE-133: Assignee: (was: Mauro Talevi) Add lightweight container support for steps Key: JBEHAVE-133 URL: http://jira.codehaus.org/browse/JBEHAVE-133 Project: JBehave Issue Type: New Feature Components: Core Affects Versions: 2.0 Reporter: Mauro Talevi In acceptance/integration tests is often common to have a lightweight container (Pico, Spring, Guice, etc ...) to configure the tests with. A container-specific Steps instance would be injectable (either via constructor or setters) with components configured in the container. The LCD approach may turn out to be insufficient, so that these container adapters for Steps should use container-specific features. -- 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-126) GivenScenarios
[ http://jira.codehaus.org/browse/JBEHAVE-126?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Mauro Talevi updated JBEHAVE-126: - Fix Version/s: (was: 2.2) 2.3 Bumping out of 2.2 release until consensus is reached on how to approach problem. GivenScenarios -- Key: JBEHAVE-126 URL: http://jira.codehaus.org/browse/JBEHAVE-126 Project: JBehave Issue Type: New Feature Components: Core Reporter: Elizabeth Keogh Assignee: Mauro Talevi Fix For: 2.3 As someone writing scenarios, I want to be able to use another scenario as a Given, so that I don't have to write big long scenarios. Not sure how this would work - at the moment we can get around it on the code side. I'm guessing we're looking for something like Given the glider where the_glider is a scenario file. (What would we do if the_glider had two scenarios in it? Throw an exception, maybe?) -- 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-156) Allow resolution of multiple textual scenarios from a single Java scenario
[ http://jira.codehaus.org/browse/JBEHAVE-156?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Mauro Talevi updated JBEHAVE-156: - Affects Version/s: (was: 2.1) 2.3 This feature may or may not be relevant any more - e.g. the JBehave Web Runner by-passes the Scenario and uses the Configuration and Steps directly. Still useful to discuss if this one-to-one mapping for IDE integration - simple and effective - may not be overcome while still preserving the same simplicity and effectiveness for scenarios that use the same Steps instance. Allow resolution of multiple textual scenarios from a single Java scenario -- Key: JBEHAVE-156 URL: http://jira.codehaus.org/browse/JBEHAVE-156 Project: JBehave Issue Type: Improvement Components: Core Affects Versions: 2.3 Reporter: Mauro Talevi Fix For: 2.2 As a scenario runner, I want to be able to run multiple textual scenarios from the same Java Scenario class, using a single Steps class instance that contains all my steps. The main refactor (backward-compatible) would be to add a method to ScenarioNameResolver ListString resolveAll(Class? extends Scenario scenarioClass); which as a special case returns a single path. In the implementation we'd also need to provide some way to configure which textual scenarios are to run. This would be useful as a start of a web or wiki-based scenario runner. -- 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-156) Allow resolution of multiple textual scenarios from a single Java scenario
[ http://jira.codehaus.org/browse/JBEHAVE-156?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Mauro Talevi updated JBEHAVE-156: - Affects Version/s: (was: 2.3) 2.0 Fix Version/s: (was: 2.2) Bumping out of 2.2 release until consensus is reached on how to approach problem. Allow resolution of multiple textual scenarios from a single Java scenario -- Key: JBEHAVE-156 URL: http://jira.codehaus.org/browse/JBEHAVE-156 Project: JBehave Issue Type: Improvement Components: Core Affects Versions: 2.0 Reporter: Mauro Talevi As a scenario runner, I want to be able to run multiple textual scenarios from the same Java Scenario class, using a single Steps class instance that contains all my steps. The main refactor (backward-compatible) would be to add a method to ScenarioNameResolver ListString resolveAll(Class? extends Scenario scenarioClass); which as a special case returns a single path. In the implementation we'd also need to provide some way to configure which textual scenarios are to run. This would be useful as a start of a web or wiki-based scenario runner. -- 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-139) Convert ant build to use ivy for dependencies
[ http://jira.codehaus.org/browse/JBEHAVE-139?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Mauro Talevi updated JBEHAVE-139: - Bumping out of 2.2 release until some Ant-driven soul is motivated to implement Ivy-based dependency lookup. Convert ant build to use ivy for dependencies - Key: JBEHAVE-139 URL: http://jira.codehaus.org/browse/JBEHAVE-139 Project: JBehave Issue Type: Improvement Components: Build system Affects Versions: 2.0 Environment: Any Reporter: Dan North Assignee: Dan North Fix For: 2.2 We currently have a lib directory with various subdirectories containing a number of dependent jars. As we add more adapters (spring, pico, test-ng) this is going to get more complex. Ivy (http://ant.apache.org/ivy) has a similar dependency resolution model to maven. By migrating to ivy we can simplify the build and remove the dependent third-party jars from the repository. -- 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-139) Convert ant build to use ivy for dependencies
[ http://jira.codehaus.org/browse/JBEHAVE-139?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Mauro Talevi updated JBEHAVE-139: - Comment: was deleted (was: Bumping out of 2.2 release until some Ant-driven soul is motivated to implement Ivy-based dependency lookup. ) Convert ant build to use ivy for dependencies - Key: JBEHAVE-139 URL: http://jira.codehaus.org/browse/JBEHAVE-139 Project: JBehave Issue Type: Improvement Components: Build system Affects Versions: 2.0 Environment: Any Reporter: Dan North Assignee: Dan North We currently have a lib directory with various subdirectories containing a number of dependent jars. As we add more adapters (spring, pico, test-ng) this is going to get more complex. Ivy (http://ant.apache.org/ivy) has a similar dependency resolution model to maven. By migrating to ivy we can simplify the build and remove the dependent third-party jars from the repository. -- 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-139) Convert ant build to use ivy for dependencies
[ http://jira.codehaus.org/browse/JBEHAVE-139?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Mauro Talevi updated JBEHAVE-139: - Fix Version/s: (was: 2.2) Bumping out of 2.2 release until some Ant-driven soul is motivated to implement Ivy-based dependency lookup. Convert ant build to use ivy for dependencies - Key: JBEHAVE-139 URL: http://jira.codehaus.org/browse/JBEHAVE-139 Project: JBehave Issue Type: Improvement Components: Build system Affects Versions: 2.0 Environment: Any Reporter: Dan North Assignee: Dan North We currently have a lib directory with various subdirectories containing a number of dependent jars. As we add more adapters (spring, pico, test-ng) this is going to get more complex. Ivy (http://ant.apache.org/ivy) has a similar dependency resolution model to maven. By migrating to ivy we can simplify the build and remove the dependent third-party jars from the repository. -- 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] Work stopped: (JBEHAVE-126) GivenScenarios
[ http://jira.codehaus.org/browse/JBEHAVE-126?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Work on JBEHAVE-126 stopped by Mauro Talevi. GivenScenarios -- Key: JBEHAVE-126 URL: http://jira.codehaus.org/browse/JBEHAVE-126 Project: JBehave Issue Type: New Feature Components: Core Reporter: Elizabeth Keogh Assignee: Mauro Talevi Fix For: 2.3 As someone writing scenarios, I want to be able to use another scenario as a Given, so that I don't have to write big long scenarios. Not sure how this would work - at the moment we can get around it on the code side. I'm guessing we're looking for something like Given the glider where the_glider is a scenario file. (What would we do if the_glider had two scenarios in it? Throw an exception, maybe?) -- 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-27) Document best practices and suggested use cases
[ http://jira.codehaus.org/browse/JBEHAVE-27?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Mauro Talevi resolved JBEHAVE-27. - Resolution: Fixed Closing for now. Wiki page will be enhanced as new use cases and best-practices become of public use. Document best practices and suggested use cases --- Key: JBEHAVE-27 URL: http://jira.codehaus.org/browse/JBEHAVE-27 Project: JBehave Issue Type: Task Components: Website Reporter: Damian Guy Assignee: Mauro Talevi Priority: Minor Fix For: 2.2 Add page document the philosophy that drove JBehave and what are the intended best practices and suggested use uses. -- 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