**
springBoot单元测试
**
1.在pom包中添加spring-boot-starter-test包引用
org.springframework.boot spring-boot-starter-test test2.代码开发
package com.test;
import junit.framework.TestCase;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
@Slf4j
public class MyTests {
/**
- 使用断言
*/
@Test
public void test() {
log.info(“test hello 2”);
TestCase.assertEquals(1, 1);
}
}