首页 > 解决方案 > Maven + Cucumber4 + Spring Integration - 无法执行黄瓜跑步者案例

问题描述

我无法使用 mvn test 执行黄瓜弹簧集成测试。请参考下面的 pom.xml -

我正在使用黄瓜-spring、黄瓜-java8、黄瓜-junit。当我尝试运行 mvn test 或 mvn clean install 时,功能没有运行。

//Code
<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>org.junit.vintage</groupId>
                <artifactId>junit-vintage-engine</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-java</artifactId>
        <version>4.8.0</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-junit</artifactId>
        <version>4.8.0</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-spring</artifactId>
        <version>4.8.0</version>
        <scope>test</scope>
    </dependency>
</dependencies>
<build>
    <plugins>

        <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
                <parallel>both</parallel>
                <threadCount>4</threadCount>
                <includes>
                    <include>**/*RunCucumberTest.java</include>
                </includes>
            </configuration>
        </plugin>
    </plugins>
</build>
</project>

标签: springspring-bootmavenjunit4

解决方案


如果您删除老式引擎(负责在新的 junit 5 平台上运行旧的 junit 3/4 测试,则不会选择您的旧测试。它是检测这些测试并在新平台上运行的 junit 老式引擎。

不幸的是,黄瓜仍在junit 4上,所以没有采摘。


推荐阅读