【发布时间】:2018-05-26 07:29:24
【问题描述】:
如何告诉@Sql 注释只为类运行一次,而不是为每个@Test 方法运行?
喜欢和@BeforeClass有同样的行为吗?
@org.springframework.test.context.jdbc.Sql(
scripts = "classpath:schema-test.sql",
executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD
)
public class TestClass {
@Test
public void test1() {
//runs the @Sql script
}
@Test
public void test2() {
//runs the @Sql script again
}
}
【问题讨论】:
-
您是只对 Junit
-
始终是最新版本。
标签: java spring junit spring-test