SlideShare a Scribd company logo
1 of 22
Download to read offline
© 2016 Pivotal
!2
Automated Testing for Digital Experiences
Justin Baumgartner, Technical Senior Consultant, Solstice
With JUnit 5
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
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
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
6
PROPRIETARY & CONFIDENTIAL
solstice.com
2006 - JUnit 4 introduced
2007 - First iPhone released
2014 - Java 8 released
2013 - Slack launched
2008 - first GitHub repo
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
JUNIT 5
8
PROPRIETARY & CONFIDENTIAL
solstice.com
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
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
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
PROPRIETARY & CONFIDENTIAL
12 solstice.com
EXTENSION MODEL (CONT)
ARCHITECTURE
EXTENSIBILITY
NEW TESTS
ANNOTATIONS
PROPRIETARY & CONFIDENTIAL
13 solstice.com
PARAMETERS
@ExtendWith(MockedSystemExtension.class)
public class SystemTest {
@Test
public void test(final MockedSystem mockedSystem) {
final Response response = mockedSystem.target().request().get();
assertEquals(response.getStatusInfo().getFamily(), Response.Status.Family.SUCCESSFUL, () ->
"status code is not 2xx");
assertEquals(response.getHeaderString("X-Hello"), "World", () -> "header 'X-Hello' not
correct");
}
}
• Allows developers to pass parameters into tests
ARCHITECTURE
EXTENSIBILITY
NEW TESTS
ANNOTATIONS
PROPRIETARY & CONFIDENTIAL
14 solstice.com
PARAMETERS (CONT)
public class MockedSystemExtension implements ParameterResolver {
@Override
public boolean supports(final ParameterContext parameterContext, final ExtensionContext extensionContext) throws
ParameterResolutionException {
return parameterContext.getParameter().getType().isAssignableFrom(MockedSystem.class);
}
@Override
public Object resolve(final ParameterContext parameterContext, final ExtensionContext extensionContext) throws
ParameterResolutionException {
final MockedSystem mockedSystem = new MockedSystem();
return mockedSystem;
}
}
ARCHITECTURE
EXTENSIBILITY
NEW TESTS
ANNOTATIONS
@TestFactory
default Collection<DynamicTest> dynamicTestsFromCollection() {
return Arrays.asList(
dynamicTest("1st dynamic test in test interface", () -> assertTrue(true)),
dynamicTest("2nd dynamic test in test interface", () -> assertEquals(4, 2 * 2))
);
}
PROPRIETARY & CONFIDENTIAL
15 solstice.com
DYNAMIC TESTS
ARCHITECTURE
EXTENSIBILITY
NEW TESTS
ANNOTATIONS
PROPRIETARY & CONFIDENTIAL
16 solstice.com
NEW TEST CONVENTIONS
PARAMETERIZED TESTS
@ParameterizedTest
@ValueSource(ints = { 1, 2, 3 })
void testWithValueSource(int argument) {
assertNotNull(argument);
}
@RepeatedTest(10)
void repeatedTest() {
// ...
}
REPEATED TESTS
ARCHITECTURE
EXTENSIBILITY
NEW TESTS
ANNOTATIONS
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
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
PROPRIETARY & CONFIDENTIAL
19 solstice.com
OTHER CHANGES - @TAG
@Tags have replaced @Categories in order to group and filter tests
ARCHITECTURE
EXTENSIBILITY
NEW TESTS
ANNOTATIONS
PROPRIETARY & CONFIDENTIAL
20 solstice.com
AND MORE!
• Nested tests
• Scenario tests
• Dynamic containers
• Java 9 compatibility
ARCHITECTURE
EXTENSIBILITY
NEW TESTS
ANNOTATIONS
PROPRIETARY & CONFIDENTIAL
21 solstice.com
SLACKBOT DEMO ARCHITECTURE
STAY IN TOUCH
22
PROPRIETARY & CONFIDENTIAL
solstice.com
Justin Baumgartner
Technical Senior Consultant
jbaumgartner@solstice.com
solstice.com
Slackbot demo: bit.ly/2r8Ctlf

More Related Content

Similar to Automated Testing for Digital Experiences With JUnit 5

谷歌 Scott-lessons learned in testability
谷歌 Scott-lessons learned in testability谷歌 Scott-lessons learned in testability
谷歌 Scott-lessons learned in testability
drewz lin
 

Similar to Automated Testing for Digital Experiences With JUnit 5 (20)

Performance Testing Workshop at CzechTest2016 – SmartMeter.io
Performance Testing Workshop at CzechTest2016 – SmartMeter.ioPerformance Testing Workshop at CzechTest2016 – SmartMeter.io
Performance Testing Workshop at CzechTest2016 – SmartMeter.io
 
New types of tests for Java projects
New types of tests for Java projectsNew types of tests for Java projects
New types of tests for Java projects
 
Level Up Your Integration Testing With Testcontainers
Level Up Your Integration Testing With TestcontainersLevel Up Your Integration Testing With Testcontainers
Level Up Your Integration Testing With Testcontainers
 
Techorama 2017 - Testing the unit, and beyond.
Techorama 2017 - Testing the unit, and beyond.Techorama 2017 - Testing the unit, and beyond.
Techorama 2017 - Testing the unit, and beyond.
 
Visual Studio 2010 Testing Overview
Visual Studio 2010 Testing OverviewVisual Studio 2010 Testing Overview
Visual Studio 2010 Testing Overview
 
6 Traits of a Successful Test Automation Architecture
6 Traits of a Successful Test Automation Architecture6 Traits of a Successful Test Automation Architecture
6 Traits of a Successful Test Automation Architecture
 
Fostering Long-Term Test Automation Success
Fostering Long-Term Test Automation SuccessFostering Long-Term Test Automation Success
Fostering Long-Term Test Automation Success
 
AOTB2014: Agile Testing on the Java Platform
AOTB2014: Agile Testing on the Java PlatformAOTB2014: Agile Testing on the Java Platform
AOTB2014: Agile Testing on the Java Platform
 
JCD 2013 OCM Java Developer
JCD 2013 OCM Java DeveloperJCD 2013 OCM Java Developer
JCD 2013 OCM Java Developer
 
OCM Java 開發人員認證與設計模式
OCM Java 開發人員認證與設計模式OCM Java 開發人員認證與設計模式
OCM Java 開發人員認證與設計模式
 
Growing Trends of Open Source UI Frameworks
Growing Trends of Open Source UI FrameworksGrowing Trends of Open Source UI Frameworks
Growing Trends of Open Source UI Frameworks
 
Mutation testing Bucharest Tech Week
Mutation testing Bucharest Tech WeekMutation testing Bucharest Tech Week
Mutation testing Bucharest Tech Week
 
Test parallelization using Jenkins
Test parallelization using JenkinsTest parallelization using Jenkins
Test parallelization using Jenkins
 
谷歌 Scott-lessons learned in testability
谷歌 Scott-lessons learned in testability谷歌 Scott-lessons learned in testability
谷歌 Scott-lessons learned in testability
 
Agile Swift
Agile SwiftAgile Swift
Agile Swift
 
Appium & Selenium Alone vs Appium & Selenium with Perfecto
Appium & Selenium Alone vs Appium & Selenium with PerfectoAppium & Selenium Alone vs Appium & Selenium with Perfecto
Appium & Selenium Alone vs Appium & Selenium with Perfecto
 
Automated Developer Testing: Achievements and Challenges
Automated Developer Testing: Achievements and ChallengesAutomated Developer Testing: Achievements and Challenges
Automated Developer Testing: Achievements and Challenges
 
Improve unit tests with Mutants!
Improve unit tests with Mutants!Improve unit tests with Mutants!
Improve unit tests with Mutants!
 
AQA_You are_Soaking_In_It_DevNexus2020
AQA_You are_Soaking_In_It_DevNexus2020AQA_You are_Soaking_In_It_DevNexus2020
AQA_You are_Soaking_In_It_DevNexus2020
 
Advanced Java Testing
Advanced Java TestingAdvanced Java Testing
Advanced Java Testing
 

More from VMware Tanzu

More from VMware Tanzu (20)

What AI Means For Your Product Strategy And What To Do About It
What AI Means For Your Product Strategy And What To Do About ItWhat AI Means For Your Product Strategy And What To Do About It
What AI Means For Your Product Strategy And What To Do About It
 
Make the Right Thing the Obvious Thing at Cardinal Health 2023
Make the Right Thing the Obvious Thing at Cardinal Health 2023Make the Right Thing the Obvious Thing at Cardinal Health 2023
Make the Right Thing the Obvious Thing at Cardinal Health 2023
 
Enhancing DevEx and Simplifying Operations at Scale
Enhancing DevEx and Simplifying Operations at ScaleEnhancing DevEx and Simplifying Operations at Scale
Enhancing DevEx and Simplifying Operations at Scale
 
Spring Update | July 2023
Spring Update | July 2023Spring Update | July 2023
Spring Update | July 2023
 
Platforms, Platform Engineering, & Platform as a Product
Platforms, Platform Engineering, & Platform as a ProductPlatforms, Platform Engineering, & Platform as a Product
Platforms, Platform Engineering, & Platform as a Product
 
Building Cloud Ready Apps
Building Cloud Ready AppsBuilding Cloud Ready Apps
Building Cloud Ready Apps
 
Spring Boot 3 And Beyond
Spring Boot 3 And BeyondSpring Boot 3 And Beyond
Spring Boot 3 And Beyond
 
Spring Cloud Gateway - SpringOne Tour 2023 Charles Schwab.pdf
Spring Cloud Gateway - SpringOne Tour 2023 Charles Schwab.pdfSpring Cloud Gateway - SpringOne Tour 2023 Charles Schwab.pdf
Spring Cloud Gateway - SpringOne Tour 2023 Charles Schwab.pdf
 
Simplify and Scale Enterprise Apps in the Cloud | Boston 2023
Simplify and Scale Enterprise Apps in the Cloud | Boston 2023Simplify and Scale Enterprise Apps in the Cloud | Boston 2023
Simplify and Scale Enterprise Apps in the Cloud | Boston 2023
 
Simplify and Scale Enterprise Apps in the Cloud | Seattle 2023
Simplify and Scale Enterprise Apps in the Cloud | Seattle 2023Simplify and Scale Enterprise Apps in the Cloud | Seattle 2023
Simplify and Scale Enterprise Apps in the Cloud | Seattle 2023
 
tanzu_developer_connect.pptx
tanzu_developer_connect.pptxtanzu_developer_connect.pptx
tanzu_developer_connect.pptx
 
Tanzu Virtual Developer Connect Workshop - French
Tanzu Virtual Developer Connect Workshop - FrenchTanzu Virtual Developer Connect Workshop - French
Tanzu Virtual Developer Connect Workshop - French
 
Tanzu Developer Connect Workshop - English
Tanzu Developer Connect Workshop - EnglishTanzu Developer Connect Workshop - English
Tanzu Developer Connect Workshop - English
 
Virtual Developer Connect Workshop - English
Virtual Developer Connect Workshop - EnglishVirtual Developer Connect Workshop - English
Virtual Developer Connect Workshop - English
 
Tanzu Developer Connect - French
Tanzu Developer Connect - FrenchTanzu Developer Connect - French
Tanzu Developer Connect - French
 
Simplify and Scale Enterprise Apps in the Cloud | Dallas 2023
Simplify and Scale Enterprise Apps in the Cloud | Dallas 2023Simplify and Scale Enterprise Apps in the Cloud | Dallas 2023
Simplify and Scale Enterprise Apps in the Cloud | Dallas 2023
 
SpringOne Tour: Deliver 15-Factor Applications on Kubernetes with Spring Boot
SpringOne Tour: Deliver 15-Factor Applications on Kubernetes with Spring BootSpringOne Tour: Deliver 15-Factor Applications on Kubernetes with Spring Boot
SpringOne Tour: Deliver 15-Factor Applications on Kubernetes with Spring Boot
 
SpringOne Tour: The Influential Software Engineer
SpringOne Tour: The Influential Software EngineerSpringOne Tour: The Influential Software Engineer
SpringOne Tour: The Influential Software Engineer
 
SpringOne Tour: Domain-Driven Design: Theory vs Practice
SpringOne Tour: Domain-Driven Design: Theory vs PracticeSpringOne Tour: Domain-Driven Design: Theory vs Practice
SpringOne Tour: Domain-Driven Design: Theory vs Practice
 
SpringOne Tour: Spring Recipes: A Collection of Common-Sense Solutions
SpringOne Tour: Spring Recipes: A Collection of Common-Sense SolutionsSpringOne Tour: Spring Recipes: A Collection of Common-Sense Solutions
SpringOne Tour: Spring Recipes: A Collection of Common-Sense Solutions
 

Recently uploaded

Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
chiefasafspells
 

Recently uploaded (20)

WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
 

Automated Testing for Digital Experiences With JUnit 5

  • 1.
  • 2. © 2016 Pivotal !2 Automated Testing for Digital Experiences Justin Baumgartner, Technical Senior Consultant, Solstice With JUnit 5
  • 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
  • 6. 6 PROPRIETARY & CONFIDENTIAL solstice.com 2006 - JUnit 4 introduced 2007 - First iPhone released 2014 - Java 8 released 2013 - Slack launched 2008 - first GitHub repo
  • 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
  • 8. JUNIT 5 8 PROPRIETARY & CONFIDENTIAL solstice.com
  • 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
  • 12. PROPRIETARY & CONFIDENTIAL 12 solstice.com EXTENSION MODEL (CONT) ARCHITECTURE EXTENSIBILITY NEW TESTS ANNOTATIONS
  • 13. PROPRIETARY & CONFIDENTIAL 13 solstice.com PARAMETERS @ExtendWith(MockedSystemExtension.class) public class SystemTest { @Test public void test(final MockedSystem mockedSystem) { final Response response = mockedSystem.target().request().get(); assertEquals(response.getStatusInfo().getFamily(), Response.Status.Family.SUCCESSFUL, () -> "status code is not 2xx"); assertEquals(response.getHeaderString("X-Hello"), "World", () -> "header 'X-Hello' not correct"); } } • Allows developers to pass parameters into tests ARCHITECTURE EXTENSIBILITY NEW TESTS ANNOTATIONS
  • 14. PROPRIETARY & CONFIDENTIAL 14 solstice.com PARAMETERS (CONT) public class MockedSystemExtension implements ParameterResolver { @Override public boolean supports(final ParameterContext parameterContext, final ExtensionContext extensionContext) throws ParameterResolutionException { return parameterContext.getParameter().getType().isAssignableFrom(MockedSystem.class); } @Override public Object resolve(final ParameterContext parameterContext, final ExtensionContext extensionContext) throws ParameterResolutionException { final MockedSystem mockedSystem = new MockedSystem(); return mockedSystem; } } ARCHITECTURE EXTENSIBILITY NEW TESTS ANNOTATIONS
  • 15. @TestFactory default Collection<DynamicTest> dynamicTestsFromCollection() { return Arrays.asList( dynamicTest("1st dynamic test in test interface", () -> assertTrue(true)), dynamicTest("2nd dynamic test in test interface", () -> assertEquals(4, 2 * 2)) ); } PROPRIETARY & CONFIDENTIAL 15 solstice.com DYNAMIC TESTS ARCHITECTURE EXTENSIBILITY NEW TESTS ANNOTATIONS
  • 16. PROPRIETARY & CONFIDENTIAL 16 solstice.com NEW TEST CONVENTIONS PARAMETERIZED TESTS @ParameterizedTest @ValueSource(ints = { 1, 2, 3 }) void testWithValueSource(int argument) { assertNotNull(argument); } @RepeatedTest(10) void repeatedTest() { // ... } REPEATED TESTS 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
  • 20. PROPRIETARY & CONFIDENTIAL 20 solstice.com AND MORE! • Nested tests • Scenario tests • Dynamic containers • Java 9 compatibility ARCHITECTURE EXTENSIBILITY NEW TESTS ANNOTATIONS
  • 21. PROPRIETARY & CONFIDENTIAL 21 solstice.com SLACKBOT DEMO ARCHITECTURE
  • 22. STAY IN TOUCH 22 PROPRIETARY & CONFIDENTIAL solstice.com Justin Baumgartner Technical Senior Consultant jbaumgartner@solstice.com solstice.com Slackbot demo: bit.ly/2r8Ctlf