springboot-test配置

阅读 78

2022-03-30

springboot-test配置

文章目录

1.依赖配置

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <!--<scope>test</scope>-->
        </dependency>

2. 测试类

测试类上的注解

@RunWith(SpringRunner.class)
@SpringBootTest

3.注意

测试类需要使用public修饰,测试类中需要启动的方法也需要使用public修饰。

备注

参考地址:https://www.jianshu.com/p/53da42731e69

精彩评论(0)

0 0 举报