類不存在
原因分析 是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() { } }