SpringBoot集成Junit测试环境
一、环境搭建
开发工具:Spring Tool Suite v_3.9.3(简称STS)
依赖包管理(pom.xml):
<!-- SpringBoot test -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
使用
package com.ustcinfo;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class HelloWordApplicationTests {
@Test
public void contextLoads() {
}
}