SpringBoot单元测试写法
@RunWith(SpringRunner.class)
@SpringBootTest
public class Test {
@Test
public void test() {
System.out.println("单元测试");
}
}
需要的pom依赖
<!--SpringBoot单元测试-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>