【Java开发框架SpringBoot】SpringBoot单元测试

SpringBoot单元测试写法

@RunWith(SpringRunner.class)
@SpringBootTest
public class Test {
    
    

    @Test
    public void test() {
    
    
        System.out.println("单元测试");
    }
}

需要的pom依赖

<!--SpringBoot单元测试-->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-test</artifactId>
    <scope>test</scope>
</dependency>

总结

如果觉得不错,可以点赞+收藏或者关注下博主。感谢阅读!

猜你喜欢

转载自blog.csdn.net/weixin_42825651/article/details/109203440