Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
887 views
in Technique[技术] by (71.8m points)

selenium - Reports are not generated when the build is failed in Maven Cucumber Reports

Reports are generating successfully when the build is successful but when there are any failed cases which cause build failure, reports are not generated.

checkBuildResult is already set to false

pom file plugin

     <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>

And the runner class is as below,

  @RunWith(Cucumber.class)
    @CucumberOptions(
            features = {"classpath:features"},
            plugin = {"pretty","json:target/cucumber.json"},
            tags = {"@currentTest"},
            glue={"helpers","stepDefinitions"},
            monochrome = true
            )
    public class RunCukesTest{

    }
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Add the following configuration to the sure fire plugin. It will not stop the maven execution after the failure. Then it will generate the report.

<testFailureIgnore>true</testFailureIgnore>

as given below with your existing configuration.

<plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-surefire-plugin</artifactId>
      <version>2.20</version>
      <configuration>
        <testFailureIgnore>true</testFailureIgnore>
     </configuration>
</plugin>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...