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() { } }