首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Junit5插件不能检测到测试

Junit5插件不能检测到测试
EN

Stack Overflow用户
提问于 2017-12-15 10:26:31
回答 1查看 2.3K关注 0票数 1

我已经研究过肯定不会有Junit 5测试和一些相关的问题,但是随着Junit5的迅速发展,这些建议似乎不再有效。

Maven : 3.3.9我的pom.xml中有以下内容

代码语言:javascript
复制
<dependencies>
    <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>23.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>3.7</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-api</artifactId>
        <version>5.0.2</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.junit.platform</groupId>
        <artifactId>junit-platform-surefire-provider</artifactId>
        <version>1.0.2</version>
        <scope>test</scope>
    </dependency>
    <!-- Only required to run tests in an IDE that bundles an older version -->
    <dependency>
        <groupId>org.junit.platform</groupId>
        <artifactId>junit-platform-launcher</artifactId>
        <version>1.0.2</version>
        <scope>test</scope>
    </dependency>
    <!-- Only required to run tests in an IDE that bundles an older version -->
    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-engine</artifactId>
        <version>5.0.2</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.junit.vintage</groupId>
        <artifactId>junit-vintage-engine</artifactId>
        <version>4.12.2</version>
        <scope>test</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.20.1</version>
        </plugin>
    </plugins>
</build>

如您所见,这是最新版本的Junit5 am猜测,但是当我运行most命令时,它仍然没有检测到任何测试。

有什么建议吗?非常肯定的是,它是maven + surefire插件+ Junit5 api + Junit5引擎没有一起玩,我很乐意升级/降级版本以使其正常工作。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-12-15 10:30:20

你可以把保险公司的评级降到v2.19

有一个公开发行反对JUnit5在肯定火2.20。

以下安全配置适用于JUnit5:

代码语言:javascript
复制
<junit.platform.version>1.0.1</junit.platform.version>
<junit.jupiter.version>5.0.1</junit.jupiter.version>
<maven.surefire.plugin.version>2.19</maven.surefire.plugin.version>

<plugin>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>${maven.surefire.plugin.version}</version>
    <dependencies>
        <dependency>
            <groupId>org.junit.platform</groupId>
            <artifactId>junit-platform-surefire-provider</artifactId>
            <version>${junit.platform.version}</version>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>${junit.jupiter.version}</version>
        </dependency>
    </dependencies>
</plugin>
票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47830325

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档