개발자 '쑥말고인절미'

[JUnit5 & AssertJ] JUnit5, AssertJ 소개 본문

STUDY/JUnit5 & AssertJ

[JUnit5 & AssertJ] JUnit5, AssertJ 소개

쑥말고인절미 2024. 5. 17. 14:21

JUnit5

  • Java 및 JVM을 위한 테스트 프레임워크
  • JUnit5 = JUnit Platform + JUnit Jupiter + JUnit Vintage
    • JUnit Platform
      • JVM에서 테스트 프레임워크를 시작하기 위한 기반 역할
      • TestEngine 플랫폼에서 실행되는 테스트 프레임워크를 개발하기 위한 API를 정의
      • 명령줄에서 플랫폼을 실행하기 위한 콘솔 런처와 플랫폼에서 하나 이상의 TestEngine을 사용하여 사용자 정의 테스트 스위트를 실행하기 위한 JUnit Platform Suite Engine을 제공
    • JUnit Jupiter
      • JUnit5에서 테스트 및 확장을 작성하기 위한 프로그래밍 모델과 확장 모델의 조합
      • JUnit5를 사용하여 테스트를 작성하기 위한 API
    • JUnit Vintage
      • TestEngine 플랫폼에서 JUnit3 및 JUnit4 기반 테스트를 실행하기 위한 TestEngin을 제공
      • 클래스 경로나 모듈 경로에 JUnit 4.12 이상이 있어야 함
  • JUnit5에는 런타임 시 Java 8(또는 그 이상)이 필요하지만, 이전 버전의 JDK로 컴파일된 코드를 계속 테스트할 수 있음
  • JUnit Jupiter는 테스트 구성 및 프레임워크 확장을 위해서 @Test, @TestFactory 등과 같은 주석들을 지원

AssertJ

  • 어써션 세트와 유용한 오류 메시지를 제공하고, 테스트 코드 가독성을 향상시키며, IDE 내에서 사용하기 쉽게 설계된 Java 라이브러리
  • AssertJ Core는 Java 8 이상이 필요
  • 아래 링크를 통해 AssertJ Core Javadoc의 최신버전을 확인할 수 있음
  • assertThatCode() 등과 같은 메소드들을 제공

참고링크

https://junit.org/junit5/docs/current/user-guide/

 

JUnit 5 User Guide

Although the JUnit Jupiter programming model and extension model do not support JUnit 4 features such as Rules and Runners natively, it is not expected that source code maintainers will need to update all of their existing tests, test extensions, and custo

junit.org

 

https://assertj.github.io/doc/

 

AssertJ - fluent assertions java library

Thanks to all the contributors of this release: Erhard Pointl, Stefano Cordio, BJ Hargrave, Jeremy Landis, Ashley Scopes, Roland Weisleder , Benedikt Bogason , Andreas Kutschera , Matthew , Chris HeZean , Leo0506 , Zhou Yicheng , Saria , Chunhao Liao , max

assertj.github.io

 

'STUDY > JUnit5 & AssertJ' 카테고리의 다른 글

[Junit5] @DisplayName  (0) 2024.05.17