简体   繁体   中英

Maven build succeeds after cucumber test fails

I have a Cucumber test which fails. After this I suspected my maven build to fail, but this still succeeds.

I made a separate cucumbertest profile to run my cucumbertests. here is (part) of my project POM.

        <profile>
        <id>cucumbertest</id>
        <build>
            <plugins>

                <plugin>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${version.surefire.plugin}</version>
                    <configuration>
                        <skipTests>true</skipTests>
                    </configuration>
                </plugin>
                <plugin>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>${version.failsafe.plugin}</version>
                    <configuration>
                        <includes>
                            <!-- only run Functional tests with this profile -->
                            <include>**/cucumber/*FT.java</include>
                        </includes>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </profile>

I also tried various configurations like

        <profile>
        <id>cucumbertest</id>
        <build>
            <plugins>

                <plugin>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${version.surefire.plugin}</version>
                    <configuration>
                        <skipTests>true</skipTests>
                    </configuration>
                </plugin>
                <plugin>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>${version.failsafe.plugin}</version>
                    <dependencies>
                        <dependency>
                            <groupId>org.apache.Maven.surefire</groupId>
                            <artifactId>surefire-junit47</artifactId>
                            <version>2.19.1</version>
                        </dependency>
                    </dependencies>
                    <executions>
                        <execution>
                            <id>integration-tests</id>
                            <goals>
                                <goal>integration-test</goal>
                                <goal>verify</goal>
                            </goals>
                            <configuration>
                                <skip>false</skip>
                                <includes>
                                    <!-- only run Functional tests with this profile -->
                                    <include>**/cucumber/*FT.java</include>
                                </includes>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>

But none of these seems to work.

Finaly found out what I did wrong.

I executed the following mvn call: mvn integration-test -Pcucumbertest... consequence of this was that the cucumber tests were executed, but not verified.

mvn verivy -Pcucumbertest does the job.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM