Details
Description
I'm working in a non maven environment. I attempted to set the output directory for reports as follows
public static class MyReportBuilder extends StoryReporterBuilder {
public MyReportBuilder()
}
Upon running the JUnits I get the following:
org.jbehave.core.reporters.FilePrintStreamFactory$PrintStreamCreationFailed: Failed to create print stream for file /home/derek/workspace/smsManagerGit/target/../build/publish/story-reports/BeforeStories.html
at org.jbehave.core.reporters.FilePrintStreamFactory.createPrintStream(FilePrintStreamFactory.java:39)
at org.jbehave.core.reporters.Format$4.createStoryReporter(Format.java:43)
at org.jbehave.core.reporters.StoryReporterBuilder.reporterFor(StoryReporterBuilder.java:310)
at org.jbehave.core.reporters.StoryReporterBuilder.build(StoryReporterBuilder.java:285)
at org.jbehave.core.configuration.Configuration.storyReporter(Configuration.java:200)
at org.jbehave.core.embedder.StoryRunner.runBeforeOrAfterStories(StoryRunner.java:58)
at org.jbehave.core.embedder.Embedder.runStoriesAsPaths(Embedder.java:209)
at au.com.sensis.wireless.smsmanager.integration.bdd.stories.AnnotatedStoryEmbedder.run(AnnotatedStoryEmbedder.java:48)
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:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
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)
Caused by: java.io.FileNotFoundException: /home/derek/workspace/smsManagerGit/target/../build/publish/story-reports/BeforeStories.html (No such file or directory)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
at org.jbehave.core.reporters.FilePrintStreamFactory$FilePrintStream.<init>(FilePrintStreamFactory.java:137)
at org.jbehave.core.reporters.FilePrintStreamFactory.createPrintStream(FilePrintStreamFactory.java:37)
... 31 more
Commenting out the withRelativeDirectory() method and everything works just fine.
Activity
Field | Original Value | New Value |
---|---|---|
Fix Version/s | 3.4 [ 17278 ] | |
Affects Version/s | web-3.3 [ 17272 ] |
Fix Version/s | 3.x [ 16979 ] | |
Fix Version/s | 3.4 [ 17278 ] |
The relativeDirectory is the directory where the JBehave reporting outputs are written to (defaults to "jbehave"), relative to the story builder code location (defaults to CodeLocations.codeLocationFromPath("target/classes")).
If you change the relative directory and you're not using the Maven standard layout, you'll probably need to set the code location accordingly, e.g. CodeLocations.codeLocationFromPath("build/publish") and withRelativeDirectory("story-reports"), or combinations thereof.
You could also try seting the code location from the JUnitStories class: CodeLocations.codeLocationFromClass(this.getClass());