spring boot 测试的几种写法

用testNG做测试

import org.testng.annotations.Test;

@SpringBootTest(classes = MyServiceTest.TestApplication.class, properties = {"spring.profiles.active=dev"})
public class MyServiceTest extends AbstractTransactionalTestNGSpringContextTests {

@Test(invocationCount = 10,threadPoolSize = 5)
public void updateProcess() throws Exception {
   
    System.out.println("test");

}

}
普通测试
@SpringBootTest(classes = SensiTest.TestApplication.class )
@ActiveProfiles("dev")
@RunWith(SpringRunner.class)public class SensiTest {
//testing...
}

你可能感兴趣的:(spring boot 测试的几种写法)