0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【SpringBoot】@Sqlをテストクラス初期化前の1回だけ実行する

Posted at

TL;DR

executionPhase = Sql.ExecutionPhase.BEFORE_TEST_CLASSを指定することで、@Sqlをストクラス初期化前の1回だけ実行するように指定できます。

本文

@Sql(org.springframework.test.context.jdbc.Sql)は、デフォルトではテストメソッドそれぞれの実行直前に実行されます。
この挙動はexecutionPhaseを指定することで変更できます。

指定可能なモード

テストメソッド実行前後とクラス実行前後の4つが選べます。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?