1.pom依赖

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

2.创建测试类:加运行启动注解,和springbooTest注解

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 PlusTest {

    @Test
    public void testQuery(){
        System.out.println("SUCESS!!!");
    }

}

这样就可以使用了!

欢迎观看逸轩学姐的博客,谢谢

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐