| layout | wiki |
|---|---|
| title | JUnit5 |
| summary | JUnit5 |
| date | 2019-10-23 09:09:38 +0900 |
| updated | 2020-06-10 21:44:19 +0900 |
| tags | test,junit |
| toc | true |
| public | true |
| parent | Test_Framwork |
| latex | false |
| adsense | true |
- TOC {:toc}
- ๋ฐฑ๊ธฐ์ ๋ Java ์ฝ๋๋ฅผ ํ
์คํธํ๋ ๋ค์ํ ๋ฐฉ๋ฒ
- JUnit5 ํน์ง
*
@DisplayName์ผ๋ก ํ ์คํธ์ ๋ํ ์ค๋ช ์ ์ ์ ์ ์๋ค.AssertAll์ ์ด์ฉํด์ multi assert ๊ฐ๋ฅํ๋ค. (๊ธฐ์กด์๋ ํ๋๊ฐ ์คํจํ๋ฉด ๋ค์ assert ๋ฅผ ์คํํ์ง ์์)assertThrows๋ฅผ ์ด์ฉํด์ exception ์ ๊ธฐ๋ํ ์ ์๊ณ , ๊ฐ์ฒด๋ฅผ ๋ฐ์์ ์ํ๋ฅผ ๊ฒ์ฆํ ์๋ ์๋ค.- ๋ฐ๋ณตํ ์คํธ ๊ฐ๋ฅ
- ParameterizedTest ๊ฐ๋ฅ
- DI ์ง์
- ๊ฐ๊ฐ์ ์์ ์ ๋ค๋ผ extention ๋ฐฉ๋ฒ์ด ๋ค๋ฅด๋ค.
@RunWith->@ExtendWith- meta annotation ์ผ๋ก ์ฌ์ฉ๊ฐ๋ฅํ๊ณ
@SpringBooTestannotaion ์ ํฌํจ ๋์ด ์๋ค.
- meta annotation ์ผ๋ก ์ฌ์ฉ๊ฐ๋ฅํ๊ณ
@TestContainers๋ฅผ ์ง์ํจ
- Jib: Containerize your Gradle Java Project
- DockerCompose ๋ฅผ ์ด์ฉํด์ IntegrationTest ํ๊ฒฝ์ ๊ตฌ์ฑํด ๋ณด์. -> Mock ์ง์
- Docker Compose JUnit Rule: ์ ์ด์ฉํ์ฌ Junit ์คํ์์ ์ ํตํฉํ๊ฒฝ์ ๋น๋ํจ.
- ๋จ์ : ๋๋ฆฌ๋ค. JUnit5 ์์ tag ๊ธฐ๋ฅ์ ์ด์ฉํด์ ํ ์คํธ ๊ทธ๋ฃน์ ๋๋ ์ CI ์๋ฒ์์๋ง ๋์ํ๊ฒ ํ ์ ๋ ์๋ค.
- Chaos Monkey For Spring Boot
- JUnit5 ํน์ง
*