将自定义信息添加到JBehave HTML报告

问题描述:

生成报告时,JBehave会自动将故事内容以及可能的断言失败放入报告中.到目前为止,一切都很好.但是,我想添加更多信息,尤其是(但不一定限于)失败的步骤.

When generating reports, JBehave automatically puts the story contents into the report, along with possible assertion failures. So far, so good. However, I would like to add some more information, especially (but not necessarily limited to) failing steps.

在当前的具体情况下,测试将生成随机文件名以确保在运行场景时的唯一性.我希望将这些在我的@Given@When注释方法中生成的名称包含在报告中.

In the concrete case at hand, the test generates random file names to guarantee uniqueness while running the scenario. I would like these names, that are generated in my @Given or @When annotated methods, to be included in the report.

我发现文档有点缺乏/混乱.我缺少明显的东西吗?

I find the documentation a bit lacking/confusing. Am I missing something obvious?

请参阅:

其他日志记录JBehave

在这种情况下,您必须将生成的文件名存储为测试驱动程序的属性,并在最后打印出来.

In your case, you would have to store the generated filenames as attributes of the test driver, and print them out at the end.