Spring Boot的单元测试

1.maven中导入两个依赖

     <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
        </dependency>

2.Test类中加上注解

@RunWith(SpringRunner.class)
@SpringBootTest
public class InsertServiceImplTest {
    @Test
    public void testInsert3() {
原文地址:https://www.cnblogs.com/woyujiezhen/p/12738460.html