Is there a way to get "given", "when", "then" visible when generating XML report from scalatest?

128 Views Asked by At

I have a tests suite with scalatest. It includes "scenario", "given", "when" and "then".

scenario("Should do something) {
      Given("Something")
      //Code

      When("We do something")
      //Code

     Then("something")
     //Code
    }

We are using maven.

When we generate an xml report, we see the scenarios but not what is written in "Given", "When", "Then".

Is there a way to include the contents of "given", "when" and "then" in xml outputs?

We tried to do it with the scalatest-maven-plugin. We don't find any option to include them.

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-surefire-plugin</artifactId>
  <version>2.7</version>
  <configuration>
    <skipTests>true</skipTests>
  </configuration>
</plugin>
<plugin>
  <groupId>org.scalatest</groupId>
  <artifactId>scalatest-maven-plugin</artifactId>
  <version>1.0</version>
  <configuration>
    <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
    <junitxml>.</junitxml>
  </configuration>
  <executions>
    <execution>
      <id>test</id>
      <goals>
        <goal>test</goal>
      </goals>
    </execution>
  </executions>
</plugin>

We got something like that in our result:

<testcase time="0.014" name="Scenario: XXX"> </testcase>

But we would like more. We would like "given", "when", "then" generated too.

Thank you very much for your help.

0

There are 0 best solutions below