83417807 2020-03-08
类不存在
原因分析 是junit5升级了 框架没有兼容
解决办法
1 改写pom.xml
<!--测试模块--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.junit.platform</groupId> <artifactId>junit-platform-launcher</artifactId> <version>1.0.1</version> <scope>test</scope> </dependency> <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter-engine</artifactId> <version>5.0.1</version> <scope>test</scope> </dependency> <dependency> <groupId>org.junit.vintage</groupId> <artifactId>junit-vintage-engine</artifactId> <version>5.5.2</version> <scope>test</scope> </dependency>
测试类
org.junit.jupiter.api.Test;
替换成
import org.junit.Test;
最后的测试单元类
package com.wechat.chat; import org.junit.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest public class ChatApplicationTests { @Test public void contextLoads() { } }