1.生成测试类 按住alt+insert弹出自动生成的选项,点击TEST 会在Test里面自动生成测试类 然后添加上 @RunWith(SpringRunner.class) @SpringBootTest 这两个注解。 import com.example.demo.car.service.