I created my own AbstractScenario class to handle the configuration of
the scenario filenames, pending steps, and reports. If I specify only
CONSOLE and TXT, reports work as expected: The jbehave-reports
directory is generated with the .txt and .stats files. If, however, I
add HTML the builder, I receive an exception:
java.lang.NullPointerException
at
org.jbehave.scenario.reporters.PrintStreamScenarioReporter$1.transform(PrintStreamScenarioReporter.java:245)
at
org.apache.commons.collections.CollectionUtils.transform(CollectionUtils.java:433)
at
org.jbehave.scenario.reporters.PrintStreamScenarioReporter.escape(PrintStreamScenarioReporter.java:252)
at
org.jbehave.scenario.reporters.PrintStreamScenarioReporter.escapeAll(PrintStreamScenarioReporter.java:230)
at
org.jbehave.scenario.reporters.PrintStreamScenarioReporter.format(PrintStreamScenarioReporter.java:222)
at
org.jbehave.scenario.reporters.PrintStreamScenarioReporter.beforeExamples(PrintStreamScenarioReporter.java:188)
at
org.jbehave.scenario.reporters.DelegatingScenarioReporter.beforeExamples(DelegatingScenarioReporter.java:80)
at
org.jbehave.scenario.ScenarioRunner.runExamplesTableScenario(ScenarioRunner.java:94)
at org.jbehave.scenario.ScenarioRunner.run(ScenarioRunner.java:63)
at org.jbehave.scenario.ScenarioRunner.run(ScenarioRunner.java:48)
at org.jbehave.scenario.ScenarioRunner.run(ScenarioRunner.java:38)
at
org.jbehave.scenario.AbstractScenario.runScenario(AbstractScenario.java:75)
at org.jbehave.scenario.JUnitScenario.runScenario(JUnitScenario.java:54)
at
org.jbehave.scenario.JUnitScenario.testScenario(JUnitScenario.java:84)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:592)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at
org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:79)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Here is my AbstractScenario. Subclasses are responsible for providing
their class objects and instantiating CandidateSteps.
package base;
import static org.jbehave.scenario.reporters.ScenarioReporterBuilder.Format.*;
import org.jbehave.scenario.*;
import org.jbehave.scenario.errors.*;
import org.jbehave.scenario.parser.*;
import org.jbehave.scenario.reporters.FilePrintStreamFactory;
import org.jbehave.scenario.reporters.ScenarioReporter;
import org.jbehave.scenario.reporters.ScenarioReporterBuilder;
import org.jbehave.scenario.steps.*;
public abstract class AbstractScenario extends JUnitScenario {
protected static ScenarioNameResolver converter = new
UnderscoredCamelCaseResolver(".scenario");
public AbstractScenario(final Class<? extends RunnableScenario>
scenarioClass, CandidateSteps... candidateSteps) {
super(new PropertyBasedConfiguration() {
@Override
public ScenarioDefiner forDefiningScenarios() {
return new ClasspathScenarioDefiner(converter, new
PatternScenarioParser(keywords()));
}
@Override
public PendingErrorStrategy forPendingSteps() {
return PendingErrorStrategy.FAILING;
}
@Override
public ScenarioReporter forReportingScenarios() {
return new ScenarioReporterBuilder(new
FilePrintStreamFactory(scenarioClass, converter))
.with(CONSOLE)
.with(HTML)
.with(TXT)
.build();
}
}, candidateSteps);
}
}
Any suggestions as to what I'm doing wrong?
Thanks.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email