How to add custom text in the junit report for a cucumber-jvm run

3.1k views Asked by At

We are using bamboo to pretty-print junit output for tests, and I would like to add some version information to the report. Is there a way to do this? I use following params:

--plugin junit:./output.xml --glue com.package.integrationtest
--plugin com.package.util.LogbackFormatter

I try to write the version in a step using the following:

stepdefs.scenario.write(String.format("version: %s",stepdefs.version);

This spits the string to the formatter (which redirects to logback) but it does not put the string in the junit formatter. Is there a way to put the string in the junit output?

1

There are 1 answers

0
Sugat Mankar On

Use jUnit annotation method.

@After
public void afterScenario(Scenario scenario) {
    scenario.write("Text you want to write in junit report");
}