spring boot web integration test, need load test data first. Now I used below way
@ActiveProfiles("test")
@Sql({"/test-schema.sql","/test-user-data.sql"})
public class FooControllerWebIntegrationTest {...}
it's ok, but I found when execute every test method, it will load test data repeatedly. See below:
2015-12-30 15:58:18.398 INFO 4739 --- [ main] o.s.jdbc.datasource.init.ScriptUtils : Executing SQL script from class path resource [test-schema.sql]
2015-12-30 15:58:18.403 INFO 4739 --- [ main] o.s.jdbc.datasource.init.ScriptUtils : Executed SQL script from class path resource [test-schema.sql] in 5 ms.
2015-12-30 15:58:18.403 INFO 4739 --- [ main] o.s.jdbc.datasource.init.ScriptUtils : Executing SQL script from class path resource [test-user-data.sql]
2015-12-30 15:58:18.412 INFO 4739 --- [ main] o.s.jdbc.datasource.init.ScriptUtils : Executed SQL script from class path resource [test-user-data.sql] in 8 ms.
but I want only load once when test the whole class and even load once when execute mvn package
, how could I do to achieve this purpose?