聊聊springboot2.2.3升级到2.4.0单元测试的区别

网友投稿 300 2022-12-01

聊聊springboot2.2.3升级到2.4.0单元测试的区别

目录springboot2.2.3升级到2.4.0单元测试区别springboot2.4降级到boot2.2.x

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然后去启动主启动类会出现

org.springframework.boot

spring-boot-starter-parent

2.2.6.RELEASE

以下提示:我的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版本

1.8

Hoxton.SR9

org.springframework.cloud

spring-cloud-dependencies

${spring-cloud.version}

pom

import

再次启动,发现可以了,好了不多bb了,我要去改接下去其他模块了

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:725. Split Linked List in Parts
下一篇:764. Largest Plus Sign
相关文章

 发表评论

暂时没有评论,来抢沙发吧~