私は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 を開始するときに、必要なものをすべて読み取り、テストを実行してから、必要なものをすべて閉じたいだけです。そして、test2 を開始します。