I have following SQL script:
insert into users (account_id,user_name,user_age,experience) values
('ACCOUNT_ID','Mike',20,2),
('ACCOUNT_ID','Jake',30,5)
;
I would like to execute this SQL script before each of my test:
@SpringBootTest(classes = UiApplication.class)
class DummyCheck {
String account_id;
@BeforeEach
void makeConfig(){
account_id = "myaccount";
// value of this variable would be taken from calling some API
// for each test would be its own value
// value is dynamic
}
@Test
@Sql(value = {"/script/InitUser.sql"})
void testCanGetAccounts() {
//some test
}
@Test
@Sql(value = {"/script/InitUser.sql"})
void testCanGetUsers() {
//some test
}
}
Question, how to pass to SQL script ACCOUNT_ID variable?
Aucun commentaire:
Enregistrer un commentaire