Java 保持jbehave测试和报告程序之间的上下文

Java 保持jbehave测试和报告程序之间的上下文,java,jbehave,Java,Jbehave,我想通过添加在测试步骤中计算的信息来定制jbehave测试的HTML报告的内容。让我们看看我想做什么: @Given("a test step") public void ... String customInfo = "calculate some info"; this.currentStepContext.info(customInfo); ... } 在html reporter中: public void successful(String step) {

我想通过添加在测试步骤中计算的信息来定制jbehave测试的HTML报告的内容。让我们看看我想做什么:

@Given("a test step")
public void ...
    String customInfo = "calculate some info";
    this.currentStepContext.info(customInfo);
    ...
}
在html reporter中:

public void successful(String step) {
    super.successful(step);
    this.outputScenario.addStep(new OutputStep(this.currentStepContext.getInfo(), ""));
}
我的问题是,在html reporter中,我没有任何指向测试步骤的链接。似乎没有共同的背景。在本例中,属性“currentStepContext”在test类和reporter类中是不同的。 我从测试步骤得到的唯一信息是参数“step”,但它只是一个字符串。 你知道我该怎么做吗

这个主题本来是有用的,但它并没有讨论共享上下文


提前感谢

事实上,我找到了一种方法,但它不使用jbehave框架。它用的是弹簧。在这两方面(测试步骤和报告器),我都可以处理由@Component注释的类,并将该类用作共享上下文。

事实上,我找到了一种方法,但它没有使用jbehave框架。它用的是弹簧。在这两方面(teststep和reporter),我都可以处理由@Component注释的类,并且我使用这个类作为共享上下文