728x90 AfterEach1 [JUnit5] 기본 테스트 어노테이션 @Test, @BeforeAll, @BeforeEach, @AfterAll, @AfterEach, @Disabled @Test 이 어노테이션을 붙이면 Test 메서드로 인식하고 테스트 한다. @Test void test1() { Study study = new Study(); System.out.println("test1"); } @BeforeAll 본 어노테이션을 붙인 메서드는 해당 테스트 클래스를 초기화할 때 딱 한번 수행되는 메서드다. 메서드 시그니쳐는 static 으로 선언해야한다. @BeforeAll static void beforeAll() { System.out.println("BeforeAll"); } @BeforeEach 본 어노테이션을 붙인 메서드는 테스트 메서드 실행 이전에 수행된다. @BeforeEach void beforeEach() { System.out.println("BeforeEach").. 2022. 9. 16. 이전 1 다음 728x90