聊聊springboot2.2.3升级到2.4.0单元测试的区别
springboot2.2.3升级到2.4.0单元测试区别
原先单元测试 import org.junit.test; 然后运行正常,现在运行报错,
import org.junit.test;
换成
import org.junit.jupiter.api.test;
后运行正常。
单个单元测试的这样没有问题了,但是我批量执行的还是会报上面的错误
@suite.suiteclasses({ //dao层测试类 //service层测试类 checkconfigservicetest.class, aftercheckconfigservicetest.class, //control层测试类 //webtestcontrollertest.class //util测试类 }) @runwith(suite.class) public class batchtest { }
最后确实没有解决整合测试也称 打包测试的@suite.suiteclasses方法,不过找到了别的批量执行单元测试的方法,
在src/test/java 文件夹右键,run as -> junit test 一样可以批量执行!!!
springboot2.4降级到boot2.2.x
最近在做一个springcloud的整合项目,但是springcloud-alibaba的nacos只支持2.2.x版本,而项目开始也没注意,直接用的2.4版本,所以这里记录下降级踩下的坑。
这里直接把boot版本号改成2.2.6然后去启动主启动类会出现
<parent> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-parent</artifactid> <version>2.2.6.release</version> <relativepath/> <!-- lookup parent from repository --> </parent>
以下提示:我的spring和我的boot不兼容,我boot版本太低,让我改成2.3或者是2.4
***************************
application failed to start
***************************description:
your project setup is incompatible with our requirements due to following reasons:
- spring boot [2.2.6.release] is not compatible with this spring cloud release train
action:consider applying the following actions:
- change spring boot version to one of the following versions [2.3.x, 2.4.x] .
you can find the latest spring boot versions here [https://spring.io/projects/spring-boot#learn].
if you want to learn more about the spring cloud release train compatibility, you can visit this page [https://spring.io/projects/spring-cloud#overview] and check the [release trains] section.
if you want to disable this check, just set the property [spring.cloud.compatibility-verifier.enabled=false]process finished with exit code 1
我这边直接把springcloud版本一起降低改成h版本
<properties> <java.version>1.8</java.version> <spring-cloud.version>hoxton.sr9</spring-cloud.version> </properties> <dependencymanagement> <dependencies> <dependency> <groupid>org.springframework.cloud</groupid> <artifactid>spring-cloud-dependencies</artifactid> <version>${spring-cloud.version}</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencymanagement>
再次启动,发现可以了,好了不多bb了,我要去改接下去其他模块了
以上为个人经验,希望能给大家一个参考,也希望大家多多支持。
下一篇: Python批量修改文件名的方式详解