@Sql
@Sql
用於註解測試類別或測試方法,以組態在整合測試期間針對給定資料庫執行的 SQL Script。以下範例示範如何使用它
-
Java
-
Kotlin
@Test
@Sql({"/test-schema.sql", "/test-user-data.sql"}) (1)
void userTest() {
// run code that relies on the test schema and test data
}
1 | 為此測試執行兩個 Script。 |
@Test
@Sql("/test-schema.sql", "/test-user-data.sql") (1)
fun userTest() {
// run code that relies on the test schema and test data
}
1 | 為此測試執行兩個 Script。 |
請參閱 使用 @Sql 宣告式執行 SQL Script 以取得更多詳細資訊。