Junit单元测试配置及基本用法

1.引入依赖

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

2.引入基本注解进行调用


@SpringBootTest(classes = 主启动类.class)
public class Test01 {

    @Autowired
    private RedisService redisService;
    @Autowired private TQuestionnaireListMapper questionnaireListMapper;

    @Test
    public void test() {
        List<TQuestionnaireList> selectList = questionnaireListMapper.list();
        System.out.println(selectList);
    }
}
posted @ 2022-01-14 17:57  白描先生  阅读(129)  评论(0编辑  收藏  举报
}); });