1

我正在尝试将 jebehave 报告输出到代码位置以外的位置(D:/abc),

URL url = null;
        try {
              url = new File("D:/abc").toURI().toURL();
        } catch (MalformedURLException e) {
              e.printStackTrace();
        }


.useStoryReporterBuilder(new StoryReporterBuilder()
            .withCodeLocation(url)                   
            .withDefaultFormats().withFormats( TXT,HTML));

但是 jbehave/view 文件夹是在 D:/ 驱动器中创建的,而不是在 D:/abc 文件夹中。可能是什么问题呢

4

2 回答 2

0

尝试使用CodeLocations类生成 URL;

.useStoryReporterBuilder(new StoryReporterBuilder()
        .withCodeLocation(CodeLocations.codeLocationFromPath("D:\\abc"))
        ...

我还在路径中用反斜杠替换了斜杠。

于 2013-08-29T13:15:58.383 回答
0

我注意到使用时:

.withCodeLocation(CodeLocations.codeLocationFromPath("D:\\abc\\xyz")) ...

JBehave 将忽略路径中最后列出的目录。因此,从上面的“D:\\abc\\xyz”路径中,JBehave 将改为写入“D:\\abc”,忽略对“xyz”的引用。

于 2016-08-03T14:19:23.330 回答