SpringBoot集成Junit测试环境

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

}

猜你喜欢

转载自blog.csdn.net/qq_35959573/article/details/80081828