I didn't post ...
--What you want from the test framework (important element) --Conciseness and readability
---- Multi-module configuration (Junit 5 has 3 configurations!) --junit platform (test execution platform) --Does not work on launcher, IDE --junit jupitaer (new test API) ―― @Test - junit vintage --Migration support
Junit5.2 → Bill of Materials -It provides a good combination of module versions of ↑
--Test method name -4 Test name = test method name - 5 @DisplayName
--Assertion
- assertEquals
--The order of arguments changes
--Assertion grouping
―― 4 When there are multiple assertions in one test (@Test), if one mistake is made, the subsequent ones will not be executed.
―― 5 Will be executed!
--assertAll () Multiply by lambda expression! All asserts and returns OK if all are OK
--Exception validation
- 4 @Test(expected = ...Exception.class) or try-catch
-5 assertThrows (
--Structure test
―― 4 public static class-> Inner class (group) for testing
―― 5 Inner class and test method can coexist using @ Nested
--Parameterization test
-4 @Runwith (Theories.class ... test runner)
@DAtaPoints`` @Theory
- 5 junit-jupiter-param module /
--... Parameterized test A function to put parameters in the arguments of the test method and turn them automatically.
--How to extend the test class - 4 Runnner (@Runwith), Rule --5 @ExtendsWith, multiple specifications allowed
Recommended Posts