zoukankan      html  css  js  c++  java
  • junit5坑: mvn构建不执行注解

    junit5本地run单个是没问题的,放到jenkins上面mvn执行,注解一直没有生效。

    本来以为是代码的方法写错了,排查后是mvn 执行的时候没有跑@BeforeAll注解。

    解决办法就是把junit engine和junit api放到dependency里面。

            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter-api</artifactId>
                <version>5.7.0-M1</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter-engine</artifactId>
                <version>5.7.0-M1</version>
                <scope>test</scope>
            </dependency>
    

      

    题外话:beforeAll只针对单个的类,不针对所有类。

  • 相关阅读:
    第五周
    第四周
    第三周作业
    第二周编程总结
    编程总结(3)
    编程总结(2)
    编程总结(1)
    第七周作业
    第六周作业
    第五周作业
  • 原文地址:https://www.cnblogs.com/zhizhiyin/p/13426182.html
Copyright © 2011-2022 走看看