springboot的测试类如何编写

一、引入springboot测试类的相关依赖

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

二、编写测试类

复制代码
package com.lzp.springcloud;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;


/**
 * @Author LZP
 * @Date 2022/6/22 13:43
 * @Version 1.0
 */
//此处classes内的内容是@SpringBootApplication入口
@SpringBootTest(classes = {PaymentMain8001.class})
@RunWith(SpringRunner.class)
public class PaymentMain8001Test {

    @Test
    public void contextText() {
    }

}
复制代码

 

posted @   没有你哪有我  阅读(2429)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· DeepSeek在M芯片Mac上本地化部署
· 葡萄城 AI 搜索升级:DeepSeek 加持,客户体验更智能
历史上的今天:
2021-06-22 MyBatis分页插件PageHelper的使用
点击右上角即可分享
微信分享提示