- Revision
- 1535
- Author
- mauro
- Date
- 2010-01-22 09:10:03 -0600 (Fri, 22 Jan 2010)
Log Message
JBEHAVE-235: Added running-examples page.
Modified Paths
- trunk/core/distribution/src/site/content/getting-started.html
- trunk/core/distribution/src/site/content/reports.html
- trunk/core/distribution/src/site/content/sitemap.xml
- trunk/core/examples/trader/build.xml
Added Paths
Diff
Modified: trunk/core/distribution/src/site/content/getting-started.html (1534 => 1535)
--- trunk/core/distribution/src/site/content/getting-started.html 2010-01-22 12:26:16 UTC (rev 1534) +++ trunk/core/distribution/src/site/content/getting-started.html 2010-01-22 15:10:03 UTC (rev 1535) @@ -11,7 +11,8 @@ <h3>Write a textual scenario</h3> <p>Create a textual scenario file with a name that expresses the -behaviour to verify, e.g. <b>i_can_toggle_a_cell</b> and define steps in it:</p> +behaviour to verify, e.g. <b>i_can_toggle_a_cell</b> and define steps in +it:</p> <pre class="brush: bdd"> Given a 5 by 5 game When I toggle the cell at (2, 3) @@ -37,8 +38,8 @@ ..X.. </pre> <p>Steps must start with one of the keywords highlighted (see <a - href="" for more details) and are -not limited to a single line.</p> + href="" for more details) and are not +limited to a single line.</p> <h3>Map scenario steps to Java methods</h3> @@ -99,14 +100,17 @@ <p>Open your favourite IDE, the <b>ICanToggleACell.java</b> class will allow itself to run as a JUnit test. Be sure to check that you have -all the required <a href="" in your classpath.</p> +all the required <a href="" in your +classpath.</p> <h2>Next?</h2> -<span class="followup">JBehave has a number of working <a - href="" -in the source repository, which illustrate its features. The examples also show command-line ways of -<a href="" scenarios</a>.</span> +<span class="followup">JBehave development has been +example-driven and it is very instructive to go through one or more working +examples in the source repository, which illustrate features. Be +sure to read about <a href="" examples</a>. +The examples also show command-line ways of <a + href="" scenarios</a>.</span> </body> </html> \ No newline at end of file
Modified: trunk/core/distribution/src/site/content/reports.html (1534 => 1535)
--- trunk/core/distribution/src/site/content/reports.html 2010-01-22 12:26:16 UTC (rev 1534) +++ trunk/core/distribution/src/site/content/reports.html 2010-01-22 15:10:03 UTC (rev 1535) @@ -78,14 +78,17 @@ (where <b>format</b> is any of <b>txt,html,xml</b> in the example above).</p> -<span class="followup">The file-based print stream factory for the scenario reporting requires the scenario class to -be provided in order to derive from it the output file paths (with the appropriate format extension). -If you want to migrate multiple scenarios to using file-based reporting, an intermediate stepping stone might be -to provide as a scenario class the parent class in which you build the scenario reporter (TraderScenario.class in the example), -which will result in all reporting (for a given format) to be appended to the same file. -Then gradually you can refactor your scenario classes to provide their class to the parent (as the example shows). Otherwise, -you may want to keep output in a single file, the choice is yours. -</span> +<span class="followup">The file-based print stream factory for +the scenario reporting requires the scenario class to be provided in +order to derive from it the output file paths (with the appropriate +format extension). If you want to migrate multiple scenarios to using +file-based reporting, an intermediate stepping stone might be to provide +as a scenario class the parent class in which you build the scenario +reporter (TraderScenario.class in the example), which will result in all +reporting (for a given format) to be appended to the same file. Then +gradually you can refactor your scenario classes to provide their class +to the parent (as the example shows). Otherwise, you may want to keep +output in a single file, the choice is yours. </span> <p>The builder provides defaults for all the formats supported, but if the user needs to create a bespoke instance of a reporter for a given @@ -126,9 +129,10 @@ bundled in the <b>jbehave-core.jar</b> (extract ftl/*.ftl, js/*.js and style/*.css) but can be overridden. The FTL files need to be the classpath for the <b>FreemarkerReportRenderer</b> to find them, while -the look and feel resources (js/*.js and style/*.css files) need to be copied -to the <b>target/jbehave-reports/rendered</b> directory (or wherever the index page has been rendered to) -Also note that the default style makes use of images found in the <b>jbehave-site-resources.jar</b>.</p> +the look and feel resources (js/*.js and style/*.css files) need to be +copied to the <b>target/jbehave-reports/rendered</b> directory (or +wherever the index page has been rendered to) Also note that the default +style makes use of images found in the <b>jbehave-site-resources.jar</b>.</p> <p>Also, note that the report formats configured should match ones found in the Ant or Maven execution for the report rendering task or @@ -152,25 +156,26 @@ </pre> <p>By default, JBehave outputs file reports to the directory <b>jbehave-reports</b> -(relative to the scenario class code source location, e.g. the <b>target</b> directory in Maven), -but this can be changed via the builder:</p> +(relative to the scenario class code source location, e.g. the <b>target</b> +directory in Maven), but this can be changed via the builder:</p> <pre class="brush: java"> new ScenarioReporterBuilder(factory).outputTo("my-reports") </pre> -<p>If the default formats or the output file directory are modified via the builder, -then correspondingly we need to inform the report render of these changes. See -<a href="" scenarios</a> for details on how to configure -these changes. -</p> +<p>If the default formats or the output file directory are modified +via the builder, then correspondingly we need to inform the report +render of these changes. See <a href="" +scenarios</a> for details on how to configure these changes.</p> <h2>Next?</h2> <span class="followup">The <a href="" example</a> is configured to have a fully-working end-to-end use of JBehave -reporting. After running the build simply open the page <b>target/jbehave-reports/rendered/index.html</b></span> +reporting (be sure to read the instructions on <a + href="" examples</a>). After running +the build simply open the page <b>target/jbehave-reports/rendered/index.html</b></span> <div class="clear"> <hr />
Added: trunk/core/distribution/src/site/content/running-examples.html (0 => 1535)
--- trunk/core/distribution/src/site/content/running-examples.html (rev 0) +++ trunk/core/distribution/src/site/content/running-examples.html 2010-01-22 15:10:03 UTC (rev 1535) @@ -0,0 +1,105 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html> +<head> +<title>Running Examples</title> +</head> + +<body> + +<h2>Running Examples with latest snapshot</h2> + +<p>JBehave was developed as behaviour and example driven. As such the examples are +an integral part of the build, verifying the correctness of the behaviour. They +are not released as artifacts, but they can be run easily from source code using Maven</p> + +<script type="syntaxhighlighter" class="brush: plain"><![CDATA[ +svn co https://svn.codehaus.org/jbehave/trunk/core +cd core +mvn clean install -Pexamples +]]></script> + +<p>The 'examples' profile instructs Maven to build the releasable modules and to verify their +behaviour by running the examples afterwards.</p> + +<h2>Running Examples against a fixed version</h2> + +<p>In some cases, it may be necessary to run the examples against a known version of JBehave.</p> + +<script type="syntaxhighlighter" class="brush: plain"><![CDATA[ +svn co https://svn.codehaus.org/jbehave/trunk/core/examples +cd examples +mvn clean install -Djbehave.version=2.4 +]]></script> + +<span class="followup">Note that running the examples in 'standalone' mode requires the JBehave parent POM to be present, as it +contains the information about the development setup of the project, e.g. the compiler, the layout of the source, etc. </span> + +<p>To ensure JBehave parent POM is available, two approaches are possible. One is to check out project source as above and install the parent POM: +</p> + +<script type="syntaxhighlighter" class="brush: plain"><![CDATA[ +svn co https://svn.codehaus.org/jbehave/trunk/core +cd core +mvn clean install -N <-- only builds and installs locally top-level parent POM +]]></script> + +<p>The other approach is to fetch the parent POM from the snapshots remote repository. For this, you need to add the +following profile to your <b>$HOME/.m2/settings.xml</b> + +<script type="syntaxhighlighter" class="brush: xml"><![CDATA[ +<profile> + <id>codehaus-snapshots</id> + <repositories> + <repository> + <id>codehaus-snapshots</id> + <url>http://snapshots.repository.codehaus.org</url> + <snapshots> + <enabled>true</enabled> + </snapshots> + <releases> + <enabled>false</enabled> + </releases> + </repository> + </repositories> + <pluginRepositories> + <pluginRepository> + <id>codehaus-snapshots</id> + <url>http://snapshots.repository.codehaus.org</url> + <snapshots> + <enabled>true</enabled> + </snapshots> + <releases> + <enabled>false</enabled> + </releases> + </pluginRepository> + </pluginRepositories> +</profile> +]]></script> + +<p>and run with additional profile</p> +<script type="syntaxhighlighter" class="brush: plain"><![CDATA[ +svn co https://svn.codehaus.org/jbehave/trunk/core/examples +cd examples +mvn clean install -Pcodehaus-snapshots -Djbehave.version=2.4 +]]></script> + +<span class="followup">As with any Maven artifact that is not expected to change, +the build or retrieval is only required once, as it will be cached in the local repository. +So, once you've built the JBehave parent POM from source or retrieved it from the snapshots +repository, you don't need to do it again, unless you think it needs to be updated.</span> + +<h2>Running Examples via Ant</h2> + +<p>While the basic infrastructure of the build is Maven-based, the examples also show how to run scenarios via Ant. +The <b>trader</b> example has an Ant build.xml which shows its use. Note that it requires the +<a href="" Ant Tasks</a> jar to be present in the <b>$ANT_HOME/lib</b> directory +in order to retrieve the dependency information from the Maven POM. +</p> + +<div class="clear"> +<hr /> +</div> + + +</body> +</html>
Modified: trunk/core/distribution/src/site/content/sitemap.xml (1534 => 1535)
--- trunk/core/distribution/src/site/content/sitemap.xml 2010-01-22 12:26:16 UTC (rev 1534) +++ trunk/core/distribution/src/site/content/sitemap.xml 2010-01-22 15:10:03 UTC (rev 1535) @@ -9,6 +9,7 @@ <page>download.html</page> <page>javadoc.html</page> <page>release-notes.html</page> + <page>running-examples.html</page> </section> <section> <name>Fundamentals</name>
Modified: trunk/core/examples/trader/build.xml (1534 => 1535)
--- trunk/core/examples/trader/build.xml 2010-01-22 12:26:16 UTC (rev 1534) +++ trunk/core/examples/trader/build.xml 2010-01-22 15:10:03 UTC (rev 1535) @@ -1,24 +1,13 @@ <!-- - Note: Use of <artifact:dependencies/> requires - ../../lib/build/maven-ant-tasks-2.0.9.jar in $ANT_HOME/lib + Note: Use of <artifact:dependencies/> requires maven-ant-tasks-2.1.jar in $ANT_HOME/lib + Download it from http://maven.apache.org/ant-tasks/download.html --> <project name="trader" default="all" xmlns:artifact="antlib:org.apache.maven.artifact.ant"> - <property name="version" value="2.4-SNAPSHOT" /> - <artifact:dependencies filesetId="dependency.fileset"> - <dependency groupId="org.jbehave" artifactId="jbehave-core" - version="${version}" scope="compile" /> - <dependency groupId="org.jbehave" artifactId="jbehave-ant" - version="${version}" scope="compile" /> - <dependency groupId="org.apache.ant" artifactId="ant" - version="1.7.0" scope="compile" /> - <dependency groupId="junit" artifactId="junit-dep" - version="4.5" scope="compile" /> - <dependency groupId="org.hamcrest" artifactId="hamcrest-all" - version="1.1" scope="compile" /> - </artifact:dependencies> + <artifact:pom id="pom" file="pom.xml" /> + <artifact:dependencies filesetId="dependency.fileset" pomRefId="pom" useScope="test"/> <target name="clean"> <delete dir="target" /> @@ -65,20 +54,20 @@ <scenarioRunner scenarioIncludes="**/scenarios/*.java" sourceDirectory="${basedir}/src/main/java" - scenarioExcludes="**/scenarios/NonSuccessful.java,**/i18n/scenarios/*.java" + scenarioExcludes="**/scenarios/*NonSuccessful.java,**/i18n/scenarios/*.java" batch="true" ignoreFailure="false" classLoaderInjected="false" /> <scenarioRunner scenarioIncludes="**/scenarios/*.java" sourceDirectory="${basedir}/src/main/java" scenarioExcludes="**/i18n/scenarios/*.java" batch="true" ignoreFailure="true" classLoaderInjected="false" /> <scenarioRunner scenarioIncludes="**/i18n/scenarios/*.java" - sourceDirectory="${basedir}/src/main/java" scenarioExcludes="" + sourceDirectory="${basedir}/src/main/java" scenarioExcludes="**/scenarios/*NonSuccessful.java" classLoaderInjected="true" /> </target> <target name="reports-resources"> <artifact:dependencies filesetId="reports.dependency.fileset"> <dependency groupId="org.jbehave" artifactId="jbehave-core" - version="${version}" scope="compile" /> + version="${pom.version}" scope="compile" /> <dependency groupId="org.jbehave.site" artifactId="jbehave-site-resources" version="2.0.1" scope="compile" /> </artifact:dependencies> @@ -86,7 +75,7 @@ <fileset refid="reports.dependency.fileset" /> <mapper type="flatten" /> </copy> - <unzip src="" + <unzip src="" dest="${basedir}/target/jbehave-reports/rendered/"> <patternset> <include name="**/*.ftl" />
To unsubscribe from this list please visit:
