본문 바로가기

Java/Test

(Test) JUnit5 - junitplatform.properties

JUnit 설정 파일로, 클래스패스 루트 (src/test/resources/)에 넣어두면 적용된다.

 

test dir 하위 resources dir 생성
resources dir 하위 junitplatform.properties file 생성
test의 resources dir 로 설정


테스트 인스턴스 라이프사이클 설정

junit.jupiter.testinstance.lifecycle.default = per_class

https://jwdeveloper.tistory.com/70

 

(Test) JUnit 5 테스트 인스턴스

모든 테스트 메서드에서 같은 객체 즉 테스트 인스턴스를 공유하는 것이 목적 변수(초기화 1 )를 하나 두고 각각의 메서드마다 1씩 증가시킬 때 2, 3 이 찍히리라 예상되지만 2라는 동일한 값만 찍힌다. int val =..

jwdeveloper.tistory.com

 

확장팩 자동 감지 기능

junit.jupiter.extensions.autodetection.enabled = true

 

@Disabled 무시하고 실행하기

junit.jupiter.conditions.deactivate = org.junit.*DisabledCondition

 



테스트 이름 표기 전략 설정

junit.jupiter.displayname.generator.default = \

    org.junit.jupiter.api.DisplayNameGenerator$ReplaceUnderscores


코드참고

https://github.com/mike6321/PURE_JAVA/tree/master/HowToTest/inflearn-the-java-test/src

 

mike6321/PURE_JAVA

Contribute to mike6321/PURE_JAVA development by creating an account on GitHub.

github.com

 

'Java > Test' 카테고리의 다른 글

(Test) JUit5 - JUnit4 Migration  (0) 2020.01.01
(Test) JUit5 확장모델  (0) 2020.01.01
(Test) JUnit 5 테스트 순서  (0) 2019.12.31
(Test) JUnit 5 테스트 인스턴스  (0) 2019.12.30
(Test) JUit5 테스트 반복하기(2)  (0) 2019.12.30