【发布时间】:2012-02-25 05:21:01
【问题描述】:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"/applicationContext-test.xml"})
@Transactional
public class MyServiceTest {
@Resource(name="myService")
public MyService myService;
@Test
public void testSeomthing() {
//do some asserts using myService.whatever()
}
}
但是测试是基于我迁移的数据,所以每次我运行我的测试套件时,我都想执行我不相关的迁移代码。我不想在每个测试类中运行@Before。我想在完整的测试过程开始时运行一次,我可以把它放在哪里?
【问题讨论】:
标签: java spring junit integration-testing junit4