Skip to content

Commit c81f618

Browse files
committed
ADD Junit5 with whileship lec
1 parent cf46797 commit c81f618

1 file changed

Lines changed: 22 additions & 2 deletions

File tree

‎_wiki/JUnit5.md‎

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ layout : wiki
33
title : JUnit5
44
summary : JUnit5
55
date : 2019-10-23 09:09:38 +0900
6-
updated : 2019-11-13 12:08:10 +0900
6+
updated : 2019-11-16 13:19:00 +0900
77
tags : test,junit
88
toc : true
99
public : true
@@ -14,7 +14,27 @@ adsense : true
1414
* TOC
1515
{:toc}
1616

17-
# 참고자료
17+
## 간단한 특징
18+
19+
* 백기선님 Java 코드를 테스트하는 다양한 방법
20+
* JUnit5 특징
21+
* `@DisplayName` 으로 테스트에 대한 설명을 적을 수 있다.
22+
* `AssertAll` 을 이용해서 multi assert 가능하다. (기존에는 하나가 실패하면 다음 assert 를 실행하지 않음)
23+
* `assertThrows` 를 이용해서 exception 을 기대할 수 있고, 객체를 받아서 상태를 검증할 수도 있다.
24+
* 반복테스트 가능
25+
* [ParameterizedTest 가능](https://www.baeldung.com/parameterized-tests-junit-5)
26+
* DI 지원
27+
* 각각의 시점에 다라 extention 방법이 다르다.
28+
* `@RunWith`-> `@ExtendWith`
29+
* meta annotation 으로 사용가능하고 `@SpringBooTest` annotaion 에 포함 되어 있다.
30+
* `@TestContainers` 를 지원함
31+
* [Jib](https://github.com/GoogleContainerTools/jib/tree/master/jib-gradle-plugin): Containerize your Gradle Java Project
32+
* DockerCompose 를 이용해서 IntegrationTest 환경을 구성해 보자. -> Mock 지양
33+
* [Docker Compose JUnit Rule](https://github.com/palantir/docker-compose-rule): 을 이용하여 Junit 실행시점에 통합환경을 빌드함.
34+
* 단점: 느리다. JUnit5 에서 tag 기능을 이용해서 테스트 그룹을 나눠서 CI 서버에서만 동작하게 할 수 도 있다.
35+
* [Chaos Monkey For Spring Boot](https://github.com/codecentric/chaos-monkey-spring-boot)
36+
37+
## 참고자료
1838

1939
* [JUnit 5 Conditional Test Examples - 환경condition 조작](https://www.mkyong.com/junit5/junit-5-conditional-test-examples/)
2040
* [Junit5 with Spring boot](https://cheese10yun.github.io/junit5-in-spring/)

0 commit comments

Comments
 (0)