JUSTIN BAUMGARTNER SOLSTICE
JUnit 5 is launching this fall and will undoubtedly move the needle for automated testing. Simultaneously, the demands of digital continue to grow and place a greater importance on automated testing for backend systems. Join Justin Baumgartner for a discussion where he will highlight the new features of JUnit 5, including Lambda support, dynamic and parameterized tests, and advances in integration testing. Justin will demonstrate the new testing features through the lens of a conversational UX experience.
3. PROPRIETARY & CONFIDENTIAL
3 solstice.com
ABOUT ME
• My name is Justin Baumgartner
• Technical Senior Consultant at Solstice
• Replatforming and modernizing Fortune 1000 monolith
• Architect on Fortune 500 Banking iOS app
4. PROPRIETARY & CONFIDENTIAL
4 solstice.com
AGENDA
• It’s All About the Tests
• Where we’ve been - through the lens of Java/Spring & JUnit 4
• Where we’re going - JUnit 5
• Slackbot demo
5. PROPRIETARY & CONFIDENTIAL
5 solstice.com
IT’S ALL ABOUT THE TESTS
Tests Have Expanded
Unit Tests have grown
into Integration Tests,
Functional Tests and
System Tests
Dev & Build Tools
Tools are constantly
adding new features
for writing/running
tests
TDD & CI/CD
Modern Software
Engineering techniques
highly value automated
tests
7. PROPRIETARY & CONFIDENTIAL
7 solstice.com
JUNIT 4 - THE GAPS
Any Day Now…
JUnit 4 built on Java
5, unable to make
use of modern
language features
Developer Friction
Rules, Runner
restrictions, etc.
Tight Coupling
Test Writing API
coupled with Test
Discovery &
Execution API’s
9. PROPRIETARY & CONFIDENTIAL
9 solstice.com
MODULARIZING JUNIT
= JUnit Platform
API for Dev & Build Tools
Test discovery and
execution
JUnit Jupiter+
Contains the developer
API’s to write tests
JUnit Vintage+
Ability to run legacy
tests (JUnit 3 & JUnit 4)
ARCHITECTURE
EXTENSIBILITY
NEW TESTS
ANNOTATIONS
10. PROPRIETARY & CONFIDENTIAL
10 solstice.com
LAMBDA SUPPORT
@Test
void lambaTest() {
List<Integer> numbers = Arrays.asList(1, 2, 3);
assertTrue(numbers
.stream()
.mapToInt(i -> i)
.sum() > 5, () -> "Sum should be greater than 5");
}
ARCHITECTURE
EXTENSIBILITY
NEW TESTS
ANNOTATIONS
11. PROPRIETARY & CONFIDENTIAL
11 solstice.com
EXTENSION MODEL
• Allows developers to hook into different test life cycle callback events via an extension
• BeforeAllCallback, BeforeEachCallback, BeforeTestExecutionCallback
• AfterTestExecutionCallback, AfterEachCallback, AfterAllCallback
ARCHITECTURE
EXTENSIBILITY
NEW TESTS
ANNOTATIONS
17. PROPRIETARY & CONFIDENTIAL
17 solstice.com
OTHER CHANGES - DISABLING TESTS
The @Disabled annotation was added in order to disable test cases and individual tests
ARCHITECTURE
EXTENSIBILITY
NEW TESTS
ANNOTATIONS
18. PROPRIETARY & CONFIDENTIAL
18 solstice.com
OTHER CHANGES - DISPLAY NAME
The @DisplayName annotation can be used to provide better description names to your tests
ARCHITECTURE
EXTENSIBILITY
NEW TESTS
ANNOTATIONS
19. PROPRIETARY & CONFIDENTIAL
19 solstice.com
OTHER CHANGES - @TAG
@Tags have replaced @Categories in order to group and filter tests
ARCHITECTURE
EXTENSIBILITY
NEW TESTS
ANNOTATIONS