我有一个带有 scalatest 的测试套件。它包括“情景”、“给定”、“何时”和“那么”。
scenario("Should do something) {
Given("Something")
//Code
When("We do something")
//Code
Then("something")
//Code
}
我们正在使用 Maven。
当我们生成 xml 报告时,我们看到的是场景,但看不到“Given”、“When”、“Then”中所写的内容。
有没有办法在 xml 输出中包含“given”、“when”和“then”的内容?
我们尝试使用 scalatest-maven-plugin 来做到这一点。我们找不到任何包含它们的选项。
<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>
我们在结果中得到了类似的结果:
<testcase time="0.014" name="Scenario: XXX"> </testcase>
但我们想要更多。我们也想生成“given”、“when”、“then”。
非常感谢您的帮助。