사용자 도구

사이트 도구


java:junit:5

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판
이전 판
다음 판 양쪽 다음 판
java:junit:5 [2020/05/24 18:50]
kwon37xi
java:junit:5 [2020/07/08 13:18]
kwon37xi
줄 1: 줄 1:
 ====== JUnit 5 ====== ====== JUnit 5 ======
 +  * https://mvnrepository.com/artifact/org.junit
 +===== API 개념 =====
 +  * **테스트 코드 작성을 위한 API**와, 그렇게 작성한 **테스트를 수행하는 Engine**을 분리하였다.
 +==== JUnit 4로 작성한 코드 ====
 +  * JUnit 4 API로 작성한 코드도 JUnit 5에서 실행가능하다.
 +  * 이 경우 [[https://mvnrepository.com/artifact/org.junit.vintage/junit-vintage-engine|junit-vintage-engine]] 으로 해당 코드를 수행한다.
 +
 +==== JUnit 5로 작성한 코드 ====
 +  * JUnit 5는 [[https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api|junit-jupiter-api]]로 테스트 코드를 작성하고
 +  * [[https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-engine|junit-jupiter-engine]]으로 테스트 코드를 수행한다.
 +
  
 ===== Gradle ===== ===== Gradle =====
줄 5: 줄 16:
 test { test {
     useJUnitPlatform()     useJUnitPlatform()
 +}
 +
 +// spring-boot-starter-test 로 의존성 지정시
 +testImplementation('org.springframework.boot:spring-boot-starter-test') {
 +    exclude group: 'org.junit.vintage', module: 'junit-vintage-engine' // junit4 지원 제외
 } }
 </code> </code>
줄 39: 줄 55:
   * [[https://johngrib.github.io/wiki/junit5-nested/|JUnit5로 계층 구조의 테스트 코드 작성하기 - 기계인간 John Grib]]   * [[https://johngrib.github.io/wiki/junit5-nested/|JUnit5로 계층 구조의 테스트 코드 작성하기 - 기계인간 John Grib]]
   * [[https://mkyong.com/junit5/junit-5-tutorials/|JUnit 5 Tutorials - Mkyong.com]]   * [[https://mkyong.com/junit5/junit-5-tutorials/|JUnit 5 Tutorials - Mkyong.com]]
 +  * [[https://www.javaworld.com/article/3537563/junit-5-tutorial-part-1-unit-testing-with-junit-5-mockito-and-hamcrest.html|JUnit 5 tutorial, part 1: Unit testing with JUnit 5, Mockito, and Hamcrest | JavaWorld]]
 +  * [[https://www.javaworld.com/article/3543268/junit-5-tutorial-part-2-unit-testing-spring-mvc-with-junit-5.html|JUnit 5 tutorial, part 2: Unit testing Spring MVC with JUnit 5 | JavaWorld]]
 +  * [[https://blogs.oracle.com/javamagazine/junit-5-6-makes-testing-easy-with-new-features|JUnit 5.6 Makes Testing Easy with New Features]]
java/junit/5.txt · 마지막으로 수정됨: 2022/08/31 10:25 저자 kwon37xi