Title: [1618] trunk/core/distribution/src/site/content/reports.html: JBEHAVE-277: Updated reports documentation.
Revision
1618
Author
mauro
Date
2010-04-26 07:36:08 -0500 (Mon, 26 Apr 2010)

Log Message

JBEHAVE-277: Updated reports documentation.

Modified Paths

Diff

Modified: trunk/core/distribution/src/site/content/reports.html (1617 => 1618)

--- trunk/core/distribution/src/site/content/reports.html	2010-04-26 11:53:05 UTC (rev 1617)
+++ trunk/core/distribution/src/site/content/reports.html	2010-04-26 12:36:08 UTC (rev 1618)
@@ -53,6 +53,8 @@
             @Override
             public ScenarioReporter forReportingScenarios() {
                 return new ScenarioReporterBuilder(new FilePrintStreamFactory(scenarioClass, resolver))
+                            .outputTo("target/jbehave-reports").outputAsAbsolute(true) // only required with Ant (cf note below)
+                            .withDefaultFormats() // add default formats
                             .with(CONSOLE)
                             .with(TXT)
                             .with(HTML)
@@ -77,6 +79,13 @@
  textual scenario.
 </span>
 
+<span class="followup">In general, the specification of the output directory is optional.  It is necessary when running with Ant as 
+a workaround for Ant's classloading strategy which uses the Ant Project.class ProtectionDomain, which in turn leads to 
+the <b>$ANT_HOME/lib</b> as the code source location.  A better solution would be to override the hacky AntClassLoader behaviour, as
+also noted by Ant folks in the <a href=""
+method.  A user-friendly way to do is being investigated.
+</span>
+
 <p>Note that we use the <a
     href=""
 to implement a builder pattern for file-based reporters via the <a
@@ -156,13 +165,23 @@
 <p>The scenario statistics report above is treated in the rendering
 slightly differently from other reports, in that the statistics are
 displayed on the index page, if available. To ensure they are always
-available the scenario reporter builder automatically builds with the <b>stats</b>
-reporter included by default. To change or remove default formats simply
-override the method:</p>
+available the scenario reporter builder is configured to have <b>stats</b>
+as a default format (although the default formats need to be added to
+the builder). 
+</p>
+
+<h2>Default Formats</h2>
+
+<p>Default formats allow users to define a builder that can be
+used in multiple configurations without having to repeat tediously all the 
+formats required, if these are used consistently.  By default, "stats" is 
+the only default format (used for collecting reporting statistics).  To modify
+simply override the method <b>withDefaultFormats()</b>.  E.g. to add "txt" as a
+default format:</p>
 <pre class="brush: java">
         new ScenarioReporterBuilder(factory){
-               protected void withDefaultFormats() {
-                    with(Format.STATS);
+               protected ScenarioReporterBuilder withDefaultFormats() {
+                    return with(Format.STATS).with(Format.TXT);
                }
         }
 </pre>
@@ -175,6 +194,14 @@
         new ScenarioReporterBuilder(factory).outputTo("my-reports")
 </pre>
 
+<p>In some cases, i.e. when using with Ant, the class code source location may not be 
+properly set, or different from what is expected.  In this case, one can tell the builder 
+to treat the output directory as an absolute path:</p>
+
+<pre class="brush: java">
+        new ScenarioReporterBuilder(factory).outputTo("target/my-reports").outputAsAbsolute(true)
+</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=""


To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Reply via email to