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() {