테스트
@SpringBootTest
@RunWith(SpringRunner.class)
@AutoConfigureMockMvc
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.MOCK)
class SampleControllerTest {
@Autowired
MockMvc mockMvc;
@Test
void hello() throws Exception {
mockMvc.perform(get("/hello"))
.andExpect(status().isOk())
.andExpect(content().string("hello keesun"))
.andDo(print());
}
}RANDOM_PORT, DEFINED_PORT
NONE
슬라이스 테스트
JsonTest
@WebMvcTest
@WebFluxTest
@DataJpaTest
테스트 유틸
OutputCapture
TestPropertyValues
TestRestTemplate
ConfigFileApplicationContextInitializer
Last updated