<dependencies>
<dependency>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-starter-testartifactId>
<scope>testscope>
<exclusions>
<exclusion>
<groupId>org.junit.vintagegroupId>
<artifactId>junit-vintage-engineartifactId>
exclusion>
exclusions>
dependency>
<dependency>
<groupId>junitgroupId>
<artifactId>junitartifactId>
<scope>testscope>
dependency>
dependencies>
com.jerry.ApplicationTest
@RunWith(SpringRunner.class)
@SpringBootTest(classes = {ApplicationTest.class})
public class ApplicationTest {
public static void main(String[] args) {
SpringApplication.run(ApplicationTest.class, args);
}
}

Ctrl + Shift + Alt + s 打开项目设置src.test.java 右键设为 TestTest Source Folders 中已经添加成功了。src.test.java 直接右键 Mark Directory as 设置。
