我有一个测试类,其中包含2个测试:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:applicationContextTest.xml" })
@Transactional
@TransactionConfiguration(defaultRollback = true)
public class MyITest extends implements BeanFactoryAware {
private BeanFactory beanFactory;
@Test
public void test1() throws Exception {}
@Test
public void test2() throws Exception {}
}
当我运行测试,单独我没有错误,但是当我运行所有测试一起出现故障。 该故障是由于一些测试修改应用程序上下文:
b = beanFactory.getBean("logDataSource", BasicDataSource.class);
b.set ...
是否有单独运行这个测试的选项? 我只想当test1的启动读取所有必要的东西,然后运行测试,然后关闭所有必要的东西。 然后开始测试2。