生成成功后,报告将成功生成,但是如果有任何失败的情况导致生成失败,则不会生成报告。
checkBuildResult 已设置为 false
pom文件插件
<plugin> <groupId>net.masterthought</groupId> <artifactId>maven-cucumber-reporting</artifactId> <version>3.13.0</version> <executions> <execution> <id>execution</id> <phase>verify</phase> <goals> <goal>generate</goal> </goals> <configuration> <projectName>Simplify360 Automation Test Report</projectName> <outputDirectory>${project.build.directory}/site/cucumber-reports</outputDirectory> <cucumberOutput>${project.build.directory}/cucumber.json</cucumberOutput> <!-- <jsonFiles> <param>${project.build.directory}/cucumber.json</param> </jsonFiles> --> <!-- <parallelTesting>false</parallelTesting> --> <buildNumber>8.4.1.2</buildNumber> <checkBuildResult>false</checkBuildResult> </configuration> </execution> </executions> </plugin>
跑步班如下
@RunWith(Cucumber.class) @CucumberOptions( features = {"classpath:features"}, plugin = {"pretty","json:target/cucumber.json"}, tags = {"@currentTest"}, glue={"helpers","stepDefinitions"}, monochrome = true ) public class RunCukesTest{ }
将以下配置添加到确定的fire插件。失败后,它不会停止执行Maven。然后它将生成报告。
<testFailureIgnore>true</testFailureIgnore>
如下面的现有配置所示。
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.20</version> <configuration> <testFailureIgnore>true</testFailureIgnore> </configuration> </plugin>