SlideShare a Scribd company logo
from Lambda to Alpha and Beyond …
Sam Brannen
@sam_brannen
JUnit
2
Sam Brannen
• Spring and Java Consultant @
• Java Developer for over 17 years
• Spring Framework Core Committer since 2007
• Swiss Spring User Group Lead
• Trainer & Conference Speaker
• JUnit 5 Core Committer since October 2015
3
Swiftmind
Experts in Spring and Enterprise Java
Areas of expertise
• Spring *
• Java EE
• Software Architecture
• Software Development
Where you find us
• Zurich, Switzerland
• @swiftmind
• http://www.swiftmind.com
4
A Show of Hands…
5
Agenda
• Impetus for Change
• JUnit Lambda
• Roadmap
• JUnit 5
• Feedback
• Q&A
6
Impetus for Change
7
Why a New Version of JUnit?
• JUnit 4.0 was released a decade ago
– a lot has changed since then…
– testing needs have matured
– expectations have grown
• Modularity  big ball of mud
• Test discovery and execution  tightly coupled
• Extensibility  lot of room for improvement
• Let’s not forget Java 8
8
Modularity in JUnit 4
• Sure there are packages
– but… there’s only THE junit.jar
9
JUnit 4 Runner API
• Very powerful
• In fact, it can do anything
• But… you can’t combine Runners
• Parameterized + SpringJUnit4ClassRunner  no way
10
JUnit 4… Rules… are meant to be broken
• JUnit 4.7: MethodRule (@Rule)
• JUnit 4.9: TestRule (@Rule / @ClassRule)
• Great for simple use cases
• Can even be combined
• But… a single rule can’t be used for method-level and
class-level callbacks
• Plus… zero support for instance-level callbacks
• Case in point: SpringClassRule / SpringMethodRule
11
JUnit Lambda
12
Crowdfunding Campaign
• Initiated by Johannes Link and
Marc Philipp
• Later joined by Matthias Merdes,
Stefan Bechtold, & Sam Brannen
• Ran from July to October 2015
• Raised 53,937 Euros from 474
individuals and companies
• 4 companies donated 6 weeks of
developer time
13
Thanks!
14
The Kick-off Team
15
Roadmap
• Prototype  December 2nd, 2015
• 5.0.0-ALPHA  February 1st, 2016
• 5.0.0-M1  in progress
– tentative release end of June 2016
• M2, M3, …  Summer 2016
• RC1, RC2, ...  Fall 2016
• GA  late 2016
16
JUnit 5
17
JUnit 5… in a Nutshell
• Modular
• Extensible
• Modern
• Forward and backward compatible
– JUnit 5 supports JUnit 3.8 and JUnit 4
– Can be run with JUnit 4
• @RunWith(JUnit5.class)
18
Architecture
• Test code depends only on
the JUnit 5 API.
• IDEs and build tools
depend on the Launcher
and Engine APIs and can
execute tests independent
of the testing framework
in use.
19
Modules
• junit5-api
• junit-launcher
• junit-engine-api
• junit5-engine
• junit4-engine
• junit4-runner
• junit-commons
• junit-console
• junit-gradle
• surefire-junit5
20
Launcher API
• Used by IDEs and build tools to launch the framework
• Central API for discovering and executing tests via one or
more engines
• TestDiscoveryRequest
– selectors and filters
• Feedback provided via the TestExecutionListener API
21
TestEngine API
• Test engine discovers and executes tests
– for a particular programming model
• Automatic discovery via Java’s ServiceLoader mechanism
• JUnit5TestEngine
• JUnit4TestEngine
• Implement your own…
22
JUnit 5 Extension Model
org.junit.gen5.api.extensions  @ExtendWith(...)
• BeforeAllCallback
• BeforeEachCallback
• BeforeTestExecutionCallback
• AfterTestExecutionCallback
• AfterEachCallback
• AfterAllCallback
• ContainerExecutionCondition
• TestExecutionCondition
• TestInstancePostProcessor
• ParameterResolver
• TestExecutionExceptionHandler
23
JUnit 5 Programming Model
org.junit.gen5.api
• Annotations and meta-annotations
• Assertions and Assumptions
• Custom display names
• Visibility
• Tagging
• Conditional test execution
• Dependency injection for constructors and methods
• Lambda expressions and method references
• Interface default methods
• Nested test classes
24
Annotations
• @Test
• @BeforeAll / @AfterAll
• @BeforeEach / @AfterEach
• @DisplayName
• @Tag / @Tags
• @Disabled
• @Nested
25
Assertions
org.junit.gen5.api.Assertions
• Limited set of core assertions
– assertEquals(), assertNotNull(), etc.
– plus assertThrows() and expectThrows()
– and assertAll()
• Supplier<String>  for lazy failure message evaluation
– message is now the last parameter
• For more power, use AssertJ, Hamcrest, etc.
26
Assumptions
org.junit.gen5.api.Assumptions
• Limited set of core assumptions
– For aborting tests mid-flight
• assumeTrue() / assumeFalse()
– BooleanSupplier, Supplier<String>
• assumingThat( ? , () -> {} );
27
DEMO
28
Test Names
• Names default to test class or test method names
– characters limited based on Java syntax
• Custom display names  @DisplayName
– Can contain spaces, special chars, and even emoji 😱
29
Dependency Injection
• Extension Model meets Programming Model
• ParameterResolver extension
– resolves parameters for constructors or methods
• TestInfo: inject into constructor, @Test, @BeforeEach, etc.
– access display name, tags, class, method
• TestInfoParameterResolver
– eating our own dog food ;-)
• See also:
– TestReporter
– MockitoExtension
– SpringExtension
30
DEMO
31
Tagging
• Declare @Tag or @Tags on an interface, class, or method
@Tag("fast")
@Test
void myFastTest() {
}
32
Custom Tags
• Declare @Tag or @Tags as a meta-annotation
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Tag("fast")
@Test
public @interface FastTest {
}
@FastTest
void myFastTest() {
}
33
Conditional Test Execution
• Extension Model meets Programming Model
• ContainerExecutionCondition
• TestExecutionCondition
• @Disabled
• DisabledCondition
– eating our own dog food ;-)
• Deactivate via Launcher/System property
– junit.conditions.deactivate = org.junit.*
34
DEMO
35
Interface Default Methods
• Introduces the concept of a test interface
– Enables multiple inheritance in tests
– Kinda like testing traits
• @BeforeEach / @AfterEach
• @Test
• @Tag
• @ExtendWith
• See StringTests example in user guide
36
Nested Test Classes
• Enables logical, hierarchical grouping of test classes
– with shared initialization and state from outer classes
• Declare @Nested on non-static nested classes
– i.e., inner classes
• You can even combine nested classes and test interfaces
• See TestingAStack example in user guide
37
Spring Support for JUnit 5
• SpringExtension
– @ExtendWith(SpringExtension.class)
– https://github.com/sbrannen/spring-test-junit5
• Works with Spring Framework 4.3
• Already supports:
– Core Spring TestContext Framework features
– Constructor and method injection via @Autowired,
@Qualifier, @Value
• Fully integrated in Spring Framework 5.0
38
DEMO
39
In Closing…
40
What’s Missing?
• Official IDE and build integration
• Dynamic tests (M1)
– registered as lambdas, streams, collections, etc.
• Parameterized tests (M2)
• Scenario tests (M3)
• Parallel execution (?)
• …
41
Resources and Feedback Channels
• Project Homepage
– http://junit.org/junit5
• User Guide
– http://junit.org/junit5/docs/current/user-guide
• Javadoc
– https://junit.ci.cloudbees.com/job/JUnit5/javadoc
• GitHub
– https://github.com/junit-team/junit5
• Sample Projects
– https://github.com/junit-team/junit5-samples
• Twitter
– https://twitter.com/JUnitTeam
• Stack Overflow
– http://stackoverflow.com/tags/junit5
42
Q & A
Sam Brannen
@sam_brannen
www.slideshare.net/sbrannen
www.swiftmind.com

More Related Content

What's hot

JUnit 5 - The Next Generation
JUnit 5 - The Next GenerationJUnit 5 - The Next Generation
JUnit 5 - The Next Generation
Kostadin Golev
 
Spring Test Framework
Spring Test FrameworkSpring Test Framework
Spring Test Framework
GlobalLogic Ukraine
 
TDD - Unit Testing
TDD - Unit TestingTDD - Unit Testing
TDD - Unit Testing
SurajSavaratkar
 
Integration Group - Robot Framework
Integration Group - Robot Framework Integration Group - Robot Framework
Integration Group - Robot Framework
OpenDaylight
 
Cucumber questions
Cucumber questionsCucumber questions
Cucumber questions
Shivaraj R
 
Junit5 brujug
Junit5 brujugJunit5 brujug
Junit5 brujug
Tim Schmitte
 
Selenium interview questions
Selenium interview questionsSelenium interview questions
Selenium interview questions
girichinna27
 
Selenium interview-questions-freshers
Selenium interview-questions-freshersSelenium interview-questions-freshers
Selenium interview-questions-freshers
Naga Mani
 
Robot framework Gowthami Goli
Robot framework Gowthami GoliRobot framework Gowthami Goli
Robot framework Gowthami Goli
Gowthami Buddi
 
Realtime selenium interview questions
Realtime selenium interview questionsRealtime selenium interview questions
Realtime selenium interview questions
Kuldeep Pawar
 
Introduction to JUnit testing in OpenDaylight
Introduction to JUnit testing in OpenDaylightIntroduction to JUnit testing in OpenDaylight
Introduction to JUnit testing in OpenDaylight
OpenDaylight
 
PL/SQL unit testing with Ruby
PL/SQL unit testing with RubyPL/SQL unit testing with Ruby
PL/SQL unit testing with Ruby
Raimonds Simanovskis
 
Python in Test automation
Python in Test automationPython in Test automation
Python in Test automation
Krishnana Sreeraman
 
JUnit 5
JUnit 5JUnit 5
Integration Group - Lithium test strategy
Integration Group - Lithium test strategyIntegration Group - Lithium test strategy
Integration Group - Lithium test strategy
OpenDaylight
 
Introduction to Robot Framework
Introduction to Robot FrameworkIntroduction to Robot Framework
Introduction to Robot Framework
Carl Su
 
TestWorks Conf Robot framework - the unsung hero of test automation - Michael...
TestWorks Conf Robot framework - the unsung hero of test automation - Michael...TestWorks Conf Robot framework - the unsung hero of test automation - Michael...
TestWorks Conf Robot framework - the unsung hero of test automation - Michael...
Xebia Nederland BV
 
Keyword Driven Testing
Keyword Driven TestingKeyword Driven Testing
Keyword Driven TestingMaveryx
 
What is new in JUnit5
What is new in JUnit5What is new in JUnit5
What is new in JUnit5
Richard Langlois P. Eng.
 
Unit testing (eng)
Unit testing (eng)Unit testing (eng)
Unit testing (eng)
Anatoliy Okhotnikov
 

What's hot (20)

JUnit 5 - The Next Generation
JUnit 5 - The Next GenerationJUnit 5 - The Next Generation
JUnit 5 - The Next Generation
 
Spring Test Framework
Spring Test FrameworkSpring Test Framework
Spring Test Framework
 
TDD - Unit Testing
TDD - Unit TestingTDD - Unit Testing
TDD - Unit Testing
 
Integration Group - Robot Framework
Integration Group - Robot Framework Integration Group - Robot Framework
Integration Group - Robot Framework
 
Cucumber questions
Cucumber questionsCucumber questions
Cucumber questions
 
Junit5 brujug
Junit5 brujugJunit5 brujug
Junit5 brujug
 
Selenium interview questions
Selenium interview questionsSelenium interview questions
Selenium interview questions
 
Selenium interview-questions-freshers
Selenium interview-questions-freshersSelenium interview-questions-freshers
Selenium interview-questions-freshers
 
Robot framework Gowthami Goli
Robot framework Gowthami GoliRobot framework Gowthami Goli
Robot framework Gowthami Goli
 
Realtime selenium interview questions
Realtime selenium interview questionsRealtime selenium interview questions
Realtime selenium interview questions
 
Introduction to JUnit testing in OpenDaylight
Introduction to JUnit testing in OpenDaylightIntroduction to JUnit testing in OpenDaylight
Introduction to JUnit testing in OpenDaylight
 
PL/SQL unit testing with Ruby
PL/SQL unit testing with RubyPL/SQL unit testing with Ruby
PL/SQL unit testing with Ruby
 
Python in Test automation
Python in Test automationPython in Test automation
Python in Test automation
 
JUnit 5
JUnit 5JUnit 5
JUnit 5
 
Integration Group - Lithium test strategy
Integration Group - Lithium test strategyIntegration Group - Lithium test strategy
Integration Group - Lithium test strategy
 
Introduction to Robot Framework
Introduction to Robot FrameworkIntroduction to Robot Framework
Introduction to Robot Framework
 
TestWorks Conf Robot framework - the unsung hero of test automation - Michael...
TestWorks Conf Robot framework - the unsung hero of test automation - Michael...TestWorks Conf Robot framework - the unsung hero of test automation - Michael...
TestWorks Conf Robot framework - the unsung hero of test automation - Michael...
 
Keyword Driven Testing
Keyword Driven TestingKeyword Driven Testing
Keyword Driven Testing
 
What is new in JUnit5
What is new in JUnit5What is new in JUnit5
What is new in JUnit5
 
Unit testing (eng)
Unit testing (eng)Unit testing (eng)
Unit testing (eng)
 

Viewers also liked

JUnit 5 - The Next Generation of JUnit - Ted's Tool Time
JUnit 5 - The Next Generation of JUnit - Ted's Tool TimeJUnit 5 - The Next Generation of JUnit - Ted's Tool Time
JUnit 5 - The Next Generation of JUnit - Ted's Tool Time
Ted Vinke
 
JUnit- A Unit Testing Framework
JUnit- A Unit Testing FrameworkJUnit- A Unit Testing Framework
JUnit- A Unit Testing Framework
Onkar Deshpande
 
Restful web services with java
Restful web services with javaRestful web services with java
Restful web services with java
Vinay Gopinath
 
05 junit
05 junit05 junit
05 junit
mha4
 
Unit testing with Junit
Unit testing with JunitUnit testing with Junit
Unit testing with Junit
Valerio Maggio
 
Advanced junit and mockito
Advanced junit and mockitoAdvanced junit and mockito
Advanced junit and mockitoMathieu Carbou
 
Maruti Baleno Euro-NCAP result sheet
Maruti Baleno Euro-NCAP result sheetMaruti Baleno Euro-NCAP result sheet
Maruti Baleno Euro-NCAP result sheet
RushLane
 
Developing RESTful WebServices using Jersey
Developing RESTful WebServices using JerseyDeveloping RESTful WebServices using Jersey
Developing RESTful WebServices using Jerseyb_kathir
 
Introduction to JUnit
Introduction to JUnitIntroduction to JUnit
Introduction to JUnit
Devvrat Shukla
 
Fast ALS-Based Matrix Factorization for Recommender Systems
Fast ALS-Based Matrix Factorization for Recommender SystemsFast ALS-Based Matrix Factorization for Recommender Systems
Fast ALS-Based Matrix Factorization for Recommender Systems
David Zibriczky
 
Unit Testing with JUnit4 by Ravikiran Janardhana
Unit Testing with JUnit4 by Ravikiran JanardhanaUnit Testing with JUnit4 by Ravikiran Janardhana
Unit Testing with JUnit4 by Ravikiran Janardhana
Ravikiran J
 
Junit
JunitJunit
Test Automation
Test AutomationTest Automation
Test Automation
Tomas Riha
 
Test Driven Development and JUnit
Test Driven Development and JUnitTest Driven Development and JUnit
Test Driven Development and JUnit
Somenath Mukhopadhyay
 
API Test Automation Tips and Tricks
API Test Automation Tips and TricksAPI Test Automation Tips and Tricks
API Test Automation Tips and Tricks
testhive
 
็Hand-on Exercise: Java Web Services using Eclipse + Tomcat & NetBeans + Glas...
็Hand-on Exercise: Java Web Services using Eclipse + Tomcat & NetBeans + Glas...็Hand-on Exercise: Java Web Services using Eclipse + Tomcat & NetBeans + Glas...
็Hand-on Exercise: Java Web Services using Eclipse + Tomcat & NetBeans + Glas...
IMC Institute
 
Unit testing with JUnit
Unit testing with JUnitUnit testing with JUnit
Unit testing with JUnit
Pokpitch Patcharadamrongkul
 
RESTful Web Services with JAX-RS
RESTful Web Services with JAX-RSRESTful Web Services with JAX-RS
RESTful Web Services with JAX-RS
Carol McDonald
 

Viewers also liked (20)

JUnit 5 - The Next Generation of JUnit - Ted's Tool Time
JUnit 5 - The Next Generation of JUnit - Ted's Tool TimeJUnit 5 - The Next Generation of JUnit - Ted's Tool Time
JUnit 5 - The Next Generation of JUnit - Ted's Tool Time
 
JUnit- A Unit Testing Framework
JUnit- A Unit Testing FrameworkJUnit- A Unit Testing Framework
JUnit- A Unit Testing Framework
 
Restful web services with java
Restful web services with javaRestful web services with java
Restful web services with java
 
05 junit
05 junit05 junit
05 junit
 
Unit testing with Junit
Unit testing with JunitUnit testing with Junit
Unit testing with Junit
 
JUNit Presentation
JUNit PresentationJUNit Presentation
JUNit Presentation
 
Advanced junit and mockito
Advanced junit and mockitoAdvanced junit and mockito
Advanced junit and mockito
 
Maruti Baleno Euro-NCAP result sheet
Maruti Baleno Euro-NCAP result sheetMaruti Baleno Euro-NCAP result sheet
Maruti Baleno Euro-NCAP result sheet
 
Developing RESTful WebServices using Jersey
Developing RESTful WebServices using JerseyDeveloping RESTful WebServices using Jersey
Developing RESTful WebServices using Jersey
 
Introduction to JUnit
Introduction to JUnitIntroduction to JUnit
Introduction to JUnit
 
Fast ALS-Based Matrix Factorization for Recommender Systems
Fast ALS-Based Matrix Factorization for Recommender SystemsFast ALS-Based Matrix Factorization for Recommender Systems
Fast ALS-Based Matrix Factorization for Recommender Systems
 
Unit Testing with JUnit4 by Ravikiran Janardhana
Unit Testing with JUnit4 by Ravikiran JanardhanaUnit Testing with JUnit4 by Ravikiran Janardhana
Unit Testing with JUnit4 by Ravikiran Janardhana
 
Junit
JunitJunit
Junit
 
Test Automation
Test AutomationTest Automation
Test Automation
 
Test Driven Development and JUnit
Test Driven Development and JUnitTest Driven Development and JUnit
Test Driven Development and JUnit
 
API Test Automation Tips and Tricks
API Test Automation Tips and TricksAPI Test Automation Tips and Tricks
API Test Automation Tips and Tricks
 
็Hand-on Exercise: Java Web Services using Eclipse + Tomcat & NetBeans + Glas...
็Hand-on Exercise: Java Web Services using Eclipse + Tomcat & NetBeans + Glas...็Hand-on Exercise: Java Web Services using Eclipse + Tomcat & NetBeans + Glas...
็Hand-on Exercise: Java Web Services using Eclipse + Tomcat & NetBeans + Glas...
 
Unit testing with JUnit
Unit testing with JUnitUnit testing with JUnit
Unit testing with JUnit
 
Selenium Webdriver
Selenium WebdriverSelenium Webdriver
Selenium Webdriver
 
RESTful Web Services with JAX-RS
RESTful Web Services with JAX-RSRESTful Web Services with JAX-RS
RESTful Web Services with JAX-RS
 

Similar to JUnit 5 - from Lambda to Alpha and beyond

JUnit 5 Slides: Next generation Framework for Testing
JUnit 5 Slides: Next generation Framework for TestingJUnit 5 Slides: Next generation Framework for Testing
JUnit 5 Slides: Next generation Framework for Testing
Surinder Mehra
 
Testing with Spring: An Introduction
Testing with Spring: An IntroductionTesting with Spring: An Introduction
Testing with Spring: An Introduction
Sam Brannen
 
Spring Framework 3.2 - What's New
Spring Framework 3.2 - What's NewSpring Framework 3.2 - What's New
Spring Framework 3.2 - What's New
Sam Brannen
 
Testing Spring MVC and REST Web Applications
Testing Spring MVC and REST Web ApplicationsTesting Spring MVC and REST Web Applications
Testing Spring MVC and REST Web Applications
Sam Brannen
 
Effective .NET Core Unit Testing with SQLite and Dapper
Effective .NET Core Unit Testing with SQLite and DapperEffective .NET Core Unit Testing with SQLite and Dapper
Effective .NET Core Unit Testing with SQLite and Dapper
Mike Melusky
 
There's more to Ratpack than non-blocking
There's more to Ratpack than non-blockingThere's more to Ratpack than non-blocking
There's more to Ratpack than non-blocking
Marcin Erdmann
 
Effective .NET Core Unit Testing with SQLite and Dapper
Effective .NET Core Unit Testing with SQLite and DapperEffective .NET Core Unit Testing with SQLite and Dapper
Effective .NET Core Unit Testing with SQLite and Dapper
Mike Melusky
 
MIGRATION - PAIN OR GAIN?
MIGRATION - PAIN OR GAIN?MIGRATION - PAIN OR GAIN?
MIGRATION - PAIN OR GAIN?
DrupalCamp Kyiv
 
Automated testing 101
Automated testing 101Automated testing 101
Automated testing 101
Tabitha Chapman
 
Test planning and software's engineering
Test planning and software's engineeringTest planning and software's engineering
Test planning and software's engineering
MansiganeshJawale
 
Salesforce Continuous Integration with AutoRABIT
Salesforce Continuous Integration with AutoRABITSalesforce Continuous Integration with AutoRABIT
Salesforce Continuous Integration with AutoRABIT
Vishnu Raju Datla
 
Context Driven Automation Gtac 2008
Context Driven Automation Gtac 2008Context Driven Automation Gtac 2008
Context Driven Automation Gtac 2008
Pete Schneider
 
Agile Testing Introduction
Agile Testing IntroductionAgile Testing Introduction
Agile Testing Introduction
Hai Tran Son
 
Nyenrode Masterclass 'DevOps unraveled' Apr 18, 2016
Nyenrode Masterclass 'DevOps unraveled' Apr 18, 2016Nyenrode Masterclass 'DevOps unraveled' Apr 18, 2016
Nyenrode Masterclass 'DevOps unraveled' Apr 18, 2016
Inspectie van het Onderwijs
 
Design p atterns
Design p atternsDesign p atterns
Design p atterns
Amr Abd El Latief
 
KrishnaToolComparisionPPT.pdf
KrishnaToolComparisionPPT.pdfKrishnaToolComparisionPPT.pdf
KrishnaToolComparisionPPT.pdf
QA or the Highway
 
It's all about feedback - code review as a great tool in the agile toolbox
It's all about feedback - code review as a great tool in the agile toolboxIt's all about feedback - code review as a great tool in the agile toolbox
It's all about feedback - code review as a great tool in the agile toolbox
Stefan Lay
 
Gerrit + Jenkins = Continuous Delivery For Big Data
Gerrit + Jenkins = Continuous Delivery For Big DataGerrit + Jenkins = Continuous Delivery For Big Data
Gerrit + Jenkins = Continuous Delivery For Big Data
Stefano Galarraga
 
Parser Breakout Session
Parser Breakout SessionParser Breakout Session
Parser Breakout Session
Zhipeng Huang
 

Similar to JUnit 5 - from Lambda to Alpha and beyond (20)

JUnit 5 Slides: Next generation Framework for Testing
JUnit 5 Slides: Next generation Framework for TestingJUnit 5 Slides: Next generation Framework for Testing
JUnit 5 Slides: Next generation Framework for Testing
 
Testing with Spring: An Introduction
Testing with Spring: An IntroductionTesting with Spring: An Introduction
Testing with Spring: An Introduction
 
Spring Framework 3.2 - What's New
Spring Framework 3.2 - What's NewSpring Framework 3.2 - What's New
Spring Framework 3.2 - What's New
 
Testing Spring MVC and REST Web Applications
Testing Spring MVC and REST Web ApplicationsTesting Spring MVC and REST Web Applications
Testing Spring MVC and REST Web Applications
 
Effective .NET Core Unit Testing with SQLite and Dapper
Effective .NET Core Unit Testing with SQLite and DapperEffective .NET Core Unit Testing with SQLite and Dapper
Effective .NET Core Unit Testing with SQLite and Dapper
 
There's more to Ratpack than non-blocking
There's more to Ratpack than non-blockingThere's more to Ratpack than non-blocking
There's more to Ratpack than non-blocking
 
Effective .NET Core Unit Testing with SQLite and Dapper
Effective .NET Core Unit Testing with SQLite and DapperEffective .NET Core Unit Testing with SQLite and Dapper
Effective .NET Core Unit Testing with SQLite and Dapper
 
MIGRATION - PAIN OR GAIN?
MIGRATION - PAIN OR GAIN?MIGRATION - PAIN OR GAIN?
MIGRATION - PAIN OR GAIN?
 
Automated testing 101
Automated testing 101Automated testing 101
Automated testing 101
 
Test planning and software's engineering
Test planning and software's engineeringTest planning and software's engineering
Test planning and software's engineering
 
Salesforce Continuous Integration with AutoRABIT
Salesforce Continuous Integration with AutoRABITSalesforce Continuous Integration with AutoRABIT
Salesforce Continuous Integration with AutoRABIT
 
Protractor survival guide
Protractor survival guideProtractor survival guide
Protractor survival guide
 
Context Driven Automation Gtac 2008
Context Driven Automation Gtac 2008Context Driven Automation Gtac 2008
Context Driven Automation Gtac 2008
 
Agile Testing Introduction
Agile Testing IntroductionAgile Testing Introduction
Agile Testing Introduction
 
Nyenrode Masterclass 'DevOps unraveled' Apr 18, 2016
Nyenrode Masterclass 'DevOps unraveled' Apr 18, 2016Nyenrode Masterclass 'DevOps unraveled' Apr 18, 2016
Nyenrode Masterclass 'DevOps unraveled' Apr 18, 2016
 
Design p atterns
Design p atternsDesign p atterns
Design p atterns
 
KrishnaToolComparisionPPT.pdf
KrishnaToolComparisionPPT.pdfKrishnaToolComparisionPPT.pdf
KrishnaToolComparisionPPT.pdf
 
It's all about feedback - code review as a great tool in the agile toolbox
It's all about feedback - code review as a great tool in the agile toolboxIt's all about feedback - code review as a great tool in the agile toolbox
It's all about feedback - code review as a great tool in the agile toolbox
 
Gerrit + Jenkins = Continuous Delivery For Big Data
Gerrit + Jenkins = Continuous Delivery For Big DataGerrit + Jenkins = Continuous Delivery For Big Data
Gerrit + Jenkins = Continuous Delivery For Big Data
 
Parser Breakout Session
Parser Breakout SessionParser Breakout Session
Parser Breakout Session
 

More from Sam Brannen

Testing with Spring, AOT, GraalVM, and JUnit 5 - Spring I/O 2023
Testing with Spring, AOT, GraalVM, and JUnit 5 - Spring I/O 2023Testing with Spring, AOT, GraalVM, and JUnit 5 - Spring I/O 2023
Testing with Spring, AOT, GraalVM, and JUnit 5 - Spring I/O 2023
Sam Brannen
 
Testing with JUnit 5 and Spring - Spring I/O 2022
Testing with JUnit 5 and Spring - Spring I/O 2022Testing with JUnit 5 and Spring - Spring I/O 2022
Testing with JUnit 5 and Spring - Spring I/O 2022
Sam Brannen
 
Get the Most out of Testing with Spring 4.2
Get the Most out of Testing with Spring 4.2Get the Most out of Testing with Spring 4.2
Get the Most out of Testing with Spring 4.2
Sam Brannen
 
Composable Software Architecture with Spring
Composable Software Architecture with SpringComposable Software Architecture with Spring
Composable Software Architecture with Spring
Sam Brannen
 
Testing Web Apps with Spring Framework 3.2
Testing Web Apps with Spring Framework 3.2Testing Web Apps with Spring Framework 3.2
Testing Web Apps with Spring Framework 3.2Sam Brannen
 
Spring Framework 4.0 to 4.1
Spring Framework 4.0 to 4.1Spring Framework 4.0 to 4.1
Spring Framework 4.0 to 4.1
Sam Brannen
 
Spring Framework 4.0 - The Next Generation - Soft-Shake 2013
Spring Framework 4.0 - The Next Generation - Soft-Shake 2013Spring Framework 4.0 - The Next Generation - Soft-Shake 2013
Spring Framework 4.0 - The Next Generation - Soft-Shake 2013
Sam Brannen
 
Spring 3.1 and MVC Testing Support - 4Developers
Spring 3.1 and MVC Testing Support - 4DevelopersSpring 3.1 and MVC Testing Support - 4Developers
Spring 3.1 and MVC Testing Support - 4Developers
Sam Brannen
 
Effective out-of-container Integration Testing - 4Developers
Effective out-of-container Integration Testing - 4DevelopersEffective out-of-container Integration Testing - 4Developers
Effective out-of-container Integration Testing - 4Developers
Sam Brannen
 
Spring 3.1 to 3.2 in a Nutshell - SDC2012
Spring 3.1 to 3.2 in a Nutshell - SDC2012Spring 3.1 to 3.2 in a Nutshell - SDC2012
Spring 3.1 to 3.2 in a Nutshell - SDC2012
Sam Brannen
 
Spring 3.1 to 3.2 in a Nutshell - Spring I/O 2012
Spring 3.1 to 3.2 in a Nutshell - Spring I/O 2012Spring 3.1 to 3.2 in a Nutshell - Spring I/O 2012
Spring 3.1 to 3.2 in a Nutshell - Spring I/O 2012
Sam Brannen
 
Spring 3.1 and MVC Testing Support
Spring 3.1 and MVC Testing SupportSpring 3.1 and MVC Testing Support
Spring 3.1 and MVC Testing Support
Sam Brannen
 
Spring 3.1 in a Nutshell - JAX London 2011
Spring 3.1 in a Nutshell - JAX London 2011Spring 3.1 in a Nutshell - JAX London 2011
Spring 3.1 in a Nutshell - JAX London 2011
Sam Brannen
 
Spring 3.1 in a Nutshell
Spring 3.1 in a NutshellSpring 3.1 in a Nutshell
Spring 3.1 in a Nutshell
Sam Brannen
 
Spring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. RESTSpring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. REST
Sam Brannen
 
Effective out-of-container Integration Testing
Effective out-of-container Integration TestingEffective out-of-container Integration Testing
Effective out-of-container Integration Testing
Sam Brannen
 
What's New in Spring 3.0
What's New in Spring 3.0What's New in Spring 3.0
What's New in Spring 3.0
Sam Brannen
 
Modular Web Applications with OSGi
Modular Web Applications with OSGiModular Web Applications with OSGi
Modular Web Applications with OSGi
Sam Brannen
 
Enterprise Applications With OSGi and SpringSource dm Server
Enterprise Applications With OSGi and SpringSource dm ServerEnterprise Applications With OSGi and SpringSource dm Server
Enterprise Applications With OSGi and SpringSource dm Server
Sam Brannen
 

More from Sam Brannen (19)

Testing with Spring, AOT, GraalVM, and JUnit 5 - Spring I/O 2023
Testing with Spring, AOT, GraalVM, and JUnit 5 - Spring I/O 2023Testing with Spring, AOT, GraalVM, and JUnit 5 - Spring I/O 2023
Testing with Spring, AOT, GraalVM, and JUnit 5 - Spring I/O 2023
 
Testing with JUnit 5 and Spring - Spring I/O 2022
Testing with JUnit 5 and Spring - Spring I/O 2022Testing with JUnit 5 and Spring - Spring I/O 2022
Testing with JUnit 5 and Spring - Spring I/O 2022
 
Get the Most out of Testing with Spring 4.2
Get the Most out of Testing with Spring 4.2Get the Most out of Testing with Spring 4.2
Get the Most out of Testing with Spring 4.2
 
Composable Software Architecture with Spring
Composable Software Architecture with SpringComposable Software Architecture with Spring
Composable Software Architecture with Spring
 
Testing Web Apps with Spring Framework 3.2
Testing Web Apps with Spring Framework 3.2Testing Web Apps with Spring Framework 3.2
Testing Web Apps with Spring Framework 3.2
 
Spring Framework 4.0 to 4.1
Spring Framework 4.0 to 4.1Spring Framework 4.0 to 4.1
Spring Framework 4.0 to 4.1
 
Spring Framework 4.0 - The Next Generation - Soft-Shake 2013
Spring Framework 4.0 - The Next Generation - Soft-Shake 2013Spring Framework 4.0 - The Next Generation - Soft-Shake 2013
Spring Framework 4.0 - The Next Generation - Soft-Shake 2013
 
Spring 3.1 and MVC Testing Support - 4Developers
Spring 3.1 and MVC Testing Support - 4DevelopersSpring 3.1 and MVC Testing Support - 4Developers
Spring 3.1 and MVC Testing Support - 4Developers
 
Effective out-of-container Integration Testing - 4Developers
Effective out-of-container Integration Testing - 4DevelopersEffective out-of-container Integration Testing - 4Developers
Effective out-of-container Integration Testing - 4Developers
 
Spring 3.1 to 3.2 in a Nutshell - SDC2012
Spring 3.1 to 3.2 in a Nutshell - SDC2012Spring 3.1 to 3.2 in a Nutshell - SDC2012
Spring 3.1 to 3.2 in a Nutshell - SDC2012
 
Spring 3.1 to 3.2 in a Nutshell - Spring I/O 2012
Spring 3.1 to 3.2 in a Nutshell - Spring I/O 2012Spring 3.1 to 3.2 in a Nutshell - Spring I/O 2012
Spring 3.1 to 3.2 in a Nutshell - Spring I/O 2012
 
Spring 3.1 and MVC Testing Support
Spring 3.1 and MVC Testing SupportSpring 3.1 and MVC Testing Support
Spring 3.1 and MVC Testing Support
 
Spring 3.1 in a Nutshell - JAX London 2011
Spring 3.1 in a Nutshell - JAX London 2011Spring 3.1 in a Nutshell - JAX London 2011
Spring 3.1 in a Nutshell - JAX London 2011
 
Spring 3.1 in a Nutshell
Spring 3.1 in a NutshellSpring 3.1 in a Nutshell
Spring 3.1 in a Nutshell
 
Spring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. RESTSpring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. REST
 
Effective out-of-container Integration Testing
Effective out-of-container Integration TestingEffective out-of-container Integration Testing
Effective out-of-container Integration Testing
 
What's New in Spring 3.0
What's New in Spring 3.0What's New in Spring 3.0
What's New in Spring 3.0
 
Modular Web Applications with OSGi
Modular Web Applications with OSGiModular Web Applications with OSGi
Modular Web Applications with OSGi
 
Enterprise Applications With OSGi and SpringSource dm Server
Enterprise Applications With OSGi and SpringSource dm ServerEnterprise Applications With OSGi and SpringSource dm Server
Enterprise Applications With OSGi and SpringSource dm Server
 

Recently uploaded

SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Jay Das
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
vrstrong314
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
Tier1 app
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
takuyayamamoto1800
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 

Recently uploaded (20)

SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 

JUnit 5 - from Lambda to Alpha and beyond

  • 1. from Lambda to Alpha and Beyond … Sam Brannen @sam_brannen JUnit
  • 2. 2 Sam Brannen • Spring and Java Consultant @ • Java Developer for over 17 years • Spring Framework Core Committer since 2007 • Swiss Spring User Group Lead • Trainer & Conference Speaker • JUnit 5 Core Committer since October 2015
  • 3. 3 Swiftmind Experts in Spring and Enterprise Java Areas of expertise • Spring * • Java EE • Software Architecture • Software Development Where you find us • Zurich, Switzerland • @swiftmind • http://www.swiftmind.com
  • 4. 4 A Show of Hands…
  • 5. 5 Agenda • Impetus for Change • JUnit Lambda • Roadmap • JUnit 5 • Feedback • Q&A
  • 7. 7 Why a New Version of JUnit? • JUnit 4.0 was released a decade ago – a lot has changed since then… – testing needs have matured – expectations have grown • Modularity  big ball of mud • Test discovery and execution  tightly coupled • Extensibility  lot of room for improvement • Let’s not forget Java 8
  • 8. 8 Modularity in JUnit 4 • Sure there are packages – but… there’s only THE junit.jar
  • 9. 9 JUnit 4 Runner API • Very powerful • In fact, it can do anything • But… you can’t combine Runners • Parameterized + SpringJUnit4ClassRunner  no way
  • 10. 10 JUnit 4… Rules… are meant to be broken • JUnit 4.7: MethodRule (@Rule) • JUnit 4.9: TestRule (@Rule / @ClassRule) • Great for simple use cases • Can even be combined • But… a single rule can’t be used for method-level and class-level callbacks • Plus… zero support for instance-level callbacks • Case in point: SpringClassRule / SpringMethodRule
  • 12. 12 Crowdfunding Campaign • Initiated by Johannes Link and Marc Philipp • Later joined by Matthias Merdes, Stefan Bechtold, & Sam Brannen • Ran from July to October 2015 • Raised 53,937 Euros from 474 individuals and companies • 4 companies donated 6 weeks of developer time
  • 15. 15 Roadmap • Prototype  December 2nd, 2015 • 5.0.0-ALPHA  February 1st, 2016 • 5.0.0-M1  in progress – tentative release end of June 2016 • M2, M3, …  Summer 2016 • RC1, RC2, ...  Fall 2016 • GA  late 2016
  • 17. 17 JUnit 5… in a Nutshell • Modular • Extensible • Modern • Forward and backward compatible – JUnit 5 supports JUnit 3.8 and JUnit 4 – Can be run with JUnit 4 • @RunWith(JUnit5.class)
  • 18. 18 Architecture • Test code depends only on the JUnit 5 API. • IDEs and build tools depend on the Launcher and Engine APIs and can execute tests independent of the testing framework in use.
  • 19. 19 Modules • junit5-api • junit-launcher • junit-engine-api • junit5-engine • junit4-engine • junit4-runner • junit-commons • junit-console • junit-gradle • surefire-junit5
  • 20. 20 Launcher API • Used by IDEs and build tools to launch the framework • Central API for discovering and executing tests via one or more engines • TestDiscoveryRequest – selectors and filters • Feedback provided via the TestExecutionListener API
  • 21. 21 TestEngine API • Test engine discovers and executes tests – for a particular programming model • Automatic discovery via Java’s ServiceLoader mechanism • JUnit5TestEngine • JUnit4TestEngine • Implement your own…
  • 22. 22 JUnit 5 Extension Model org.junit.gen5.api.extensions  @ExtendWith(...) • BeforeAllCallback • BeforeEachCallback • BeforeTestExecutionCallback • AfterTestExecutionCallback • AfterEachCallback • AfterAllCallback • ContainerExecutionCondition • TestExecutionCondition • TestInstancePostProcessor • ParameterResolver • TestExecutionExceptionHandler
  • 23. 23 JUnit 5 Programming Model org.junit.gen5.api • Annotations and meta-annotations • Assertions and Assumptions • Custom display names • Visibility • Tagging • Conditional test execution • Dependency injection for constructors and methods • Lambda expressions and method references • Interface default methods • Nested test classes
  • 24. 24 Annotations • @Test • @BeforeAll / @AfterAll • @BeforeEach / @AfterEach • @DisplayName • @Tag / @Tags • @Disabled • @Nested
  • 25. 25 Assertions org.junit.gen5.api.Assertions • Limited set of core assertions – assertEquals(), assertNotNull(), etc. – plus assertThrows() and expectThrows() – and assertAll() • Supplier<String>  for lazy failure message evaluation – message is now the last parameter • For more power, use AssertJ, Hamcrest, etc.
  • 26. 26 Assumptions org.junit.gen5.api.Assumptions • Limited set of core assumptions – For aborting tests mid-flight • assumeTrue() / assumeFalse() – BooleanSupplier, Supplier<String> • assumingThat( ? , () -> {} );
  • 28. 28 Test Names • Names default to test class or test method names – characters limited based on Java syntax • Custom display names  @DisplayName – Can contain spaces, special chars, and even emoji 😱
  • 29. 29 Dependency Injection • Extension Model meets Programming Model • ParameterResolver extension – resolves parameters for constructors or methods • TestInfo: inject into constructor, @Test, @BeforeEach, etc. – access display name, tags, class, method • TestInfoParameterResolver – eating our own dog food ;-) • See also: – TestReporter – MockitoExtension – SpringExtension
  • 31. 31 Tagging • Declare @Tag or @Tags on an interface, class, or method @Tag("fast") @Test void myFastTest() { }
  • 32. 32 Custom Tags • Declare @Tag or @Tags as a meta-annotation @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) @Tag("fast") @Test public @interface FastTest { } @FastTest void myFastTest() { }
  • 33. 33 Conditional Test Execution • Extension Model meets Programming Model • ContainerExecutionCondition • TestExecutionCondition • @Disabled • DisabledCondition – eating our own dog food ;-) • Deactivate via Launcher/System property – junit.conditions.deactivate = org.junit.*
  • 35. 35 Interface Default Methods • Introduces the concept of a test interface – Enables multiple inheritance in tests – Kinda like testing traits • @BeforeEach / @AfterEach • @Test • @Tag • @ExtendWith • See StringTests example in user guide
  • 36. 36 Nested Test Classes • Enables logical, hierarchical grouping of test classes – with shared initialization and state from outer classes • Declare @Nested on non-static nested classes – i.e., inner classes • You can even combine nested classes and test interfaces • See TestingAStack example in user guide
  • 37. 37 Spring Support for JUnit 5 • SpringExtension – @ExtendWith(SpringExtension.class) – https://github.com/sbrannen/spring-test-junit5 • Works with Spring Framework 4.3 • Already supports: – Core Spring TestContext Framework features – Constructor and method injection via @Autowired, @Qualifier, @Value • Fully integrated in Spring Framework 5.0
  • 40. 40 What’s Missing? • Official IDE and build integration • Dynamic tests (M1) – registered as lambdas, streams, collections, etc. • Parameterized tests (M2) • Scenario tests (M3) • Parallel execution (?) • …
  • 41. 41 Resources and Feedback Channels • Project Homepage – http://junit.org/junit5 • User Guide – http://junit.org/junit5/docs/current/user-guide • Javadoc – https://junit.ci.cloudbees.com/job/JUnit5/javadoc • GitHub – https://github.com/junit-team/junit5 • Sample Projects – https://github.com/junit-team/junit5-samples • Twitter – https://twitter.com/JUnitTeam • Stack Overflow – http://stackoverflow.com/tags/junit5
  • 42. 42 Q & A Sam Brannen @sam_brannen www.slideshare.net/sbrannen www.swiftmind.com