페이지

2021년 7월 2일 금요일

Spring Boot Annotaions

@RunWith(SpringRunner.class)	Run test with Spring Context.
@SpringBootTest Search for Spring Boot Application for configuration.
@TestConfiguration Specify a Spring configuration for your test.
@MockBean Injects Mockito Mock
@SpyBean Injects Mockito Spy
@JsonTest Creates a Jackson or Gson object mapper via Spring Boot.
@WebMvcTest Used to test web context without a full http server.
@DataJpaTest Used to test data layer with embedded database.
@TestPropertySource Configure the property sources for the test.
@DirtiesContext Resets the Spring Context after the test(expensive to do).
@WebAppConfiguration Indicates Spring should use a Web Application context.
@TestExecutionListeners Allows you to specify listeners for testing events.
@Transactional Run test in transaction, rollback when complete by default.
@BeforeTranasaction Action to run before starting a transaction.
@AfterTransaction Action to run after a transaction.
@Commit Specifies the transaction should be committed after the test.
@Rollback Transaction should be rolled back after test.(Default action)
@Sql Specify SQL scripts to run before.
@SqlConfig Define meta data for SQL scripts.
@SqlGroup Group fo @Sql annotations.
@Repeat Repeat test x number of times.
@Timed Similar to JUnit's timeout, but will wait for test to complete, unlike JUnit.
@IfProfileValue Indicates test is enabled for a specific testing environment.
@ProfileValueSourceConfiguration Specify a profile value source.

댓글 없음: