I have a test Class which contains 2 test:
@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 {}
}
When I run tests individually I get no errors, but when I run all tests together there is a failure. This failure is due to some tests modifying the application context:
b = beanFactory.getBean("logDataSource", BasicDataSource.class);
b.set ...
Is there an option to run this test separately? I just want when test1 start it read all necessary things then run test and then close all necessary things. And then start test2.