接着上回SpringBoot教程(二)使用Mybatis实现增删改查
编辑器使用IntelliJ IDEA
确保pom.xml
已添加单元测试依赖库
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
这里以AdServiceImpl.java
为例
在类名那里点击右键
选择要进行测试的方法,选择后点击OK会自动生成相应的测试方法
SpringBoot中使用junit编写单元测试默认是会事务回滚的,即删除修改新增等操作不会影响数据表里的数据
https://blog.51cto.com/u_15401512/4309802