样例如下:其中前面4个注解非常重要,不要删除!!!
@SpringBootTest
@TestExecutionListeners({DependencyInjectionTestExecutionListener.class, DirtiesContextTestExecutionListener.class,
TransactionalTestExecutionListener.class, SqlScriptsTestExecutionListener.class})
@Transactional
@Rollback(false)
public class TestDemo extends AbstractTestNGSpringContextTests {
@Autowired
BusQuestionAnswerService busQuestionAnswerService;
@Test
public void testcase1(){
Assert.assertTrue(true);
busQuestionAnswerService.delQuestionAnswer("1e977b3b62b84d98904328abef445980");
System.out.println("testcase1: ");
}
@Test
public void testcase2(){
Assert.assertTrue(true);
System.out.println("testcase2");
}
}
testNg测试样例——testng读取springboot依赖注入的类
最新推荐文章于 2021-12-28 19:59:49 发布