SlideShare a Scribd company logo
Sam Brannen
@sam_brannen
JUnit
2@sam_brannen #JUnit5 #springio19
Sam Brannen
• Principal Software Engineer
• Java Developer for over 20 years
• Spring Framework Core Committer since 2007
• JUnit 5 Core Committer since October 2015
@sam_brannen #JUnit5 #springio19 3
Agenda
JUnit 5
JUnit Jupiter
Migrating from JUnit 4
New Features since 5.0
Roadmap
Spring and JUnit Jupiter
Q & A
Show of hands…
What is JUnit 5?
P L A T F O R M
J U P I T E RV I N T A G E
P A R T Y
T H I R D
7@sam_brannen #JUnit5 #springio19
JUnit 5 = Platform + Jupiter + Vintage
• JUnit Platform
• Foundation for launching testing frameworks on the JVM
• Launcher and TestEngine APIs
• ConsoleLauncher
• JUnit Jupiter
• New programming model & extension model for JUnit 5
• JUnit Vintage
• TestEngine for running JUnit 3 & JUnit 4 based tests
Revolutionary
Evolutionary
Necessary
8@sam_brannen #JUnit5 #springio19
In a Nutshell, JUnit 5 is …
• Complete rewrite of JUnit
• Improving on what JUnit 4 had to offer
• With extensibility in mind
• Modular, Extensible, & Modern
• Forward and backward compatible
• JUnit Platform supports JUnit 3.8, JUnit 4, and JUnit Jupiter
• Plus support for any TestEngine imaginable
9@sam_brannen #JUnit5 #springio19
Third-party TestEngines
• Specsy
• Spek
• Cucumber
• Drools Scenario
• jqwik
source: https://github.com/junit-team/junit5/wiki/Third-party-Extensions
10@sam_brannen #JUnit5 #springio19
Java Versions
Baseline
• AUTOMATIC-MODULE-NAM
E
• module-path scanning
Building and testi
ng against 11 and
12
11@sam_brannen #JUnit5 #springio19
IDEs and Build Tools
• IntelliJ: since IDEA 2016.2+
• Eclipse: since Eclipse Oxygen 4.7.1a+
• NetBeans: since Apache NetBeans 10.0
• Gradle: official test task support since Gradle 4.6
• Maven: official support since Maven Surefire 2.22.0
• Ant: junitlauncher task since Ant 1.10.3
See user guide and
sample apps for
examples
12@sam_brannen #JUnit5 #springio19
Releases
Version Date
5.0.0 September 10th, 2017
5.1.0 February 18th, 2018
5.2.0 April 29th, 2018
5.3.0 September 3rd, 2018
5.4.0 February 7th, 2019
5.4.2 April 7th, 2019
So, what is JUnit Jupiter?
14@sam_brannen #JUnit5 #springio19
In a Nutshell, JUnit Jupiter is …
“The new programming model and extension model in JUnit 5”
• Programming Model
• How you write tests
• Annotations
• Assertions
• Assumptions
• Types of tests
• Extension Model
• How you and third parties extend the framework
• Spring, Mockito, Selenium, …
15@sam_brannen #JUnit5 #springio19
More Powerful Programming Model
What you can do with JUnit Jupiter that you can’t do with JUnit 4.
• Visibility
• Everything does not have to be public
• Custom display names
• @DisplayName: spaces, special characters, emoji 😱
• DisplayNameGenerator (since 5.4)
• Tagging
• @Tag replaces experimental @Category
• Tag Expression Language (since 5.1)
16@sam_brannen #JUnit5 #springio19
Example: CalculatorTests
@DisplayName("Calculator Unit Tests")
class CalculatorTests {
private final Calculator calculator = new Calculator();
@Test
@DisplayName("➕")
void add() {
assertEquals(5, calculator.add(2, 3),
() -> "2 + 3 = " + (2 + 3));
}
// ...
}
17@sam_brannen #JUnit5 #springio19
Expected Exceptions
@Test
@DisplayName("n ➗ 0 → ArithmeticException")
void divideByZero() {
Exception exception = assertThrows(ArithmeticException.class,
() -> calculator.divide(1, 0));
assertEquals("/ by zero", exception.getMessage());
}
18@sam_brannen #JUnit5 #springio19
Timeouts
@Test
@DisplayName("Ensure Fibonacci computation is 'fast enough'")
void fibonacci() {
// assertTimeout(ofMillis(1000),
// () -> calculator.fibonacci(30));
assertTimeoutPreemptively(ofMillis(1000),
() -> calculator.fibonacci(30));
}
DEMO
basic test class
20@sam_brannen #JUnit5 #springio19
Even More Power and Expressiveness
• Meta-annotation support
• Create your own custom composed annotations
• Combine annotations from Spring and JUnit
• Conditional test execution
• Dependency injection for constructors and methods
• Lambda expressions and method references
• Interface default methods and testing traits
• @Nested test classes
• @RepeatedTest, @ParameterizedTest, @TestFactory
• @TestInstance lifecycle management
Tagging & Custom Annotations
22@sam_brannen #JUnit5 #springio19
Tagging
@Tag("fast")
@Test
void myFastTest() {
}
• Declare @Tag on a test interface, class, or method
23@sam_brannen #JUnit5 #springio19
Custom Tags
@Target(METHOD)
@Retention(RUNTIME)
@Tag("fast")
public @interface Fast {
}
• Declare @Tag as a meta-annotation
@Fast
@Test
void myFastTest() {}
24@sam_brannen #JUnit5 #springio19
Composed Tags
@Target(METHOD)
@Retention(RUNTIME)
@Tag("fast")
@Test
public @interface FastTest {
}
• Declare @Tag as a meta-annotation with other annotations (JUnit, Spring, etc.)
@FastTest
void myFastTest() {}
@RepeatedTest,
@ParameterizedTest, @TestFactory
26@sam_brannen #JUnit5 #springio19
@RepeatedTest
@RepeatedTest(5)
void repeatedTest(RepetitionInfo repetitionInfo) {
assertEquals(5, repetitionInfo.getTotalRepetitions());
}
@RepeatedTest(
value = 5,
name = "Wiederholung {currentRepetition} von {totalRepetitions}"
)
void repeatedTestInGerman() {
// ...
}
27@sam_brannen #JUnit5 #springio19
Parameterized Tests (junit-jupiter-params)
• Annotate a method with @ParameterizedTest instead of @Test
o and specify the source of the arguments
o optionally override the display name
• Sources
o @ValueSource: char, short, byte, int, long, float, double, String, Class
o @NullSource, @EmptySource, and @NullAndEmptySource (since 5.4)
o @EnumSource
o @MethodSource
o @CsvSource & @CsvFileSource
o @ArgumentsSource & custom ArgumentsProvider
28@sam_brannen #JUnit5 #springio19
Argument Conversion and Aggregation
• Implicit conversion
o Primitive types and their wrappers
o Enums
o File, URL, Currency, Locale, …
o java.time types (JSR-310)
o factory constructor or static factory method
• Explicit conversion
o @ConvertWith and custom ArgumentConverter
o @JavaTimeConversionPattern built-in support for JSR-310
• Argument Aggregation (since 5.2)
o Arguments and ArgumentAggregator
29@sam_brannen #JUnit5 #springio19
@ParameterizedTest – @ValueSource
@ParameterizedTest
@ValueSource(strings = {
"mom",
"dad",
"radar",
"racecar",
"able was I ere I saw elba"
})
void palindromes(String candidate) {
assertTrue(isPalindrome(candidate));
}
30@sam_brannen #JUnit5 #springio19
@ParameterizedTest – @MethodSource
@ParameterizedTest
@MethodSource // ("palindromes")
void palindromes(String candidate) {
assertTrue(isPalindrome(candidate));
}
static Stream<String> palindromes() {
return Stream.of("mom",
"dad",
"radar",
"racecar",
"able was I ere I saw elba");
}
31@sam_brannen #JUnit5 #springio19
Dynamic Tests
@TestFactory
Stream<DynamicTest> dynamicTestsFromIntStream() {
// Generates tests for the first 10 even integers.
return IntStream.iterate(0, n -> n + 2)
.limit(10)
.mapToObj(n ->
dynamicTest("test" + n,
() -> assertTrue(n % 2 == 0)));
}
DEMO
repeated, parameterized, and dynamic tests
Parallel Test Execution
34@sam_brannen #JUnit5 #springio19
Configuring Parallelism (5.3)
• Set junit.jupiter.execution.parallel.enabled config param to true
o in junit-platform.properties
o via Launcher API
o as JVM system property
• Configure the junit.jupiter.execution.parallel.config.strategy
o dynamic (the default)
o fixed
o custom
35@sam_brannen #JUnit5 #springio19
Execution Mode and Synchronization (5.3)
• Disable parallel execution on a per test basis
o @Execution(SAME_THREAD) // or CONCURRENT
• Control synchronization
o @ResourceLock("myResource") // default READ_WRITE
o @ResourceLock(value = "myResource", mode = READ)
DEMO
ParameterizedFibonacciTests
Focus on Extensibility
38@sam_brannen #JUnit5 #springio19
New Extension Model
• Extension
• marker interface
• org.junit.jupiter.api.extension
• package containing all extension APIs
• implement as many as you like
• @ExtendWith(...)
• used to register one or more extensions
• interface, class, or method level
o or as a meta-annotation
• @RegisterExtension
• programmatic registration via fields (since 5.1)
39@sam_brannen #JUnit5 #springio19
Extension APIs – Lifecycle Callbacks
• BeforeAllCallback
• BeforeEachCallback
• BeforeTestExecutionCallback
• AfterTestExecutionCallback
• AfterEachCallback
• AfterAllCallback
Extensions wrap
user-supplied
lifecycle methods
and test methods
40@sam_brannen #JUnit5 #springio19
Extension APIs – Miscellaneous
• ExecutionCondition
• TestInstanceFactory (since 5.3)
• TestInstancePostProcessor
• ParameterResolver
• TestTemplateInvocationContextProvider
• TestExecutionExceptionHandler
• TestWatcher (since 5.4)
• DisplayNameGenerator (since 5.4)
• MethodOrderer (since 5.4)
Dependency Injectio
n
Applied during the
discovery phase
41@sam_brannen #JUnit5 #springio19
DisplayNameGenerator (5.4)
• SPI for generating custom display names for classes and methods
• Configured via @DisplayNameGeneration
• Implement your own
• Or use a built-in implementation:
• Standard: default behavior
• ReplaceUnderscores: replaces underscores with spaces
42@sam_brannen #JUnit5 #springio19
MethodOrderer (5.4)
• API for controlling test method execution order
• Configured via @TestMethodOrder
• Implement your own
• Or use a built-in implementation:
• Alphanumeric: sorted alphanumerically
• OrderAnnotation: sorted based on @Order
• Random: pseudo-random ordering
What’s the significance of
@Disabled?
44@sam_brannen #JUnit5 #springio19
Conditional Test Execution
• Extension Model meets Programming Model
• ExecutionCondition
• @Disabled
• DisabledCondition
• eating our own dog food ;-)
• Deactivate via Launcher, JVM system property, or the
junit-platform.properties file
• junit.conditions.deactivate = org.junit.*
Game Changer
45@sam_brannen #JUnit5 #springio19
Built-in Conditions (5.1)
• @Disabled (since 5.0)
• @EnabledIf / @DisabledIf (may soon be deprecated)
• @EnabledOnJre / @DisabledOnJre
• @EnabledOnOs / @DisabledOnOs
• @EnabledIfSystemProperty / @DisabledIfSystemProperty
• @EnabledIfEnvironmentVariable / @DisabledIfEnvironmentVariable
Migrating from JUnit 4
47@sam_brannen #JUnit5 #springio19
Do I have to migrate from JUnit 4 to JUnit 5?
• Yes and No…
• You can run JUnit 4 tests on the JUnit Platform via the VintageTestEngine
• You can run JUnit 4 tests alongside JUnit Jupiter tests
o In the same project
• You can gradually migrate existing JUnit 4 tests to JUnit Jupiter
o if you want to
o or… you can just write all new tests in JUnit Jupiter
48@sam_brannen #JUnit5 #springio19
Annotations, Assertions, Assumptions
• @org.junit.Test  @org.junit.jupiter.api.Test
• @Ignore  @Disabled
• @BeforeClass / @AfterClass  @BeforeAll / @AfterAll
• @Before / @After  @BeforeEach / @AfterEach
• org.junit.Assert  org.junit.jupiter.api.Assertions
• org.junit.Assume  org.junit.jupiter.api.Assumptions
Failure message n
ow comes LAST!
49@sam_brannen #JUnit5 #springio19
JUnit 4 Rule Migration Support
• @EnableRuleMigrationSupport
o located in experimental junit-jupiter-migrationsupport module
o registers 3 extensions for JUnit Jupiter
• ExternalResourceSupport
o TemporaryFolder, etc.
• VerifierSupport
o ErrorCollector, etc.
• ExpectedExceptionSupport
o ExpectedException
50@sam_brannen #JUnit5 #springio19
JUnit 4 @Ignore and Assumption Support
(5.4)
• @EnableJUnit4MigrationSupport
o registers the IgnoreCondition
o supports @Ignore analogous to @Disabled
o includes @EnableRuleMigrationSupport semantics
• JUnit Jupiter supports JUnit 4 assumptions
o methods in org.junit.Assume
o AssumptionViolatedException
New since JUnit 5.0
52@sam_brannen #JUnit5 #springio19
New Features since 5.0
• JUnit Maven BOM
• Parallel test execution
• Output capture for System.out and System.err
• Tag expression language
• Custom test sources for dynamic tests
• Improved Kotlin support
• Numerous enhancements for parameterized tests
• Built-in @Enable* / @Disable* conditions
• @RegisterExtension
• TestInstanceFactory
• …
53@sam_brannen #JUnit5 #springio19
New Features since 5.4
• New junit-jupiter dependency aggregating artifact
• XML report generating listener
• Test Kit for testing engines and extensions
• null and empty argument sources for @ParameterizedTest methods
• @TempDir support for temporary directories
• DisplayNameGenerator SPI
• TestWatcher extension API
• Ordering for @Test methods and @RegisterExtension fields
• Improved JUnit 4 migration support for assumptions and @Ignore
• …
On the Horizon…
55@sam_brannen #JUnit5 #springio19
Coming in JUnit 5.5
• Boolean values in @ValueSource
• Repeatable annotations for built-in conditions
• Declarative, preemptive timeouts for tests in JUnit Jupiter
• New InvocationInterceptor extension API
• execution in a user-defined thread
• Configurable test discovery implementation for test engines
• …
56@sam_brannen #JUnit5 #springio19
The 5.x Backlog
• Custom ClassLoader
• Programmatic extension management
• Declarative and programmatic test suites for the JUnit Platform
• Parameterized test classes
• Scenario tests
• New XML / JSON reporting format
• …
Spring and JUnit Jupiter
58@sam_brannen #JUnit5 #springio19
Spring Support for JUnit Jupiter
• Fully integrated in Spring Framework 5.0!
• Supports all Core Spring TestContext Framework features
• Constructor and method injection via @Autowired, @Qualifier, @Value
• Conditional test execution via SpEL expressions
• ApplicationContext configuration annotations
• Also works with Spring Framework 4.3
https://github.com/sbrannen/spring-test-junit5
59@sam_brannen #JUnit5 #springio19
Configuring JUnit Jupiter with Spring
• SpringExtension
• @ExtendWith(SpringExtension.class)
• @SpringJUnitConfig
• @ContextConfiguration + SpringExtension
• @SpringJUnitWebConfig
• @SpringJUnitConfig + @WebAppConfiguration
• @EnabledIf / @DisabledIf
• SpEL expression evaluation for conditional execution
60@sam_brannen #JUnit5 #springio19
Automatic Test Constructor Autowiring (5.2)
• By default, a test class constructor must be annotated with @Autowired
• The ”default” can be changed
• set spring.test.constructor.autowire=true
• JVM system property or SpringProperties mechanism
• @TestConstructor(autowire = true/false)
• Overrides default on a per-class basis
61@sam_brannen #JUnit5 #springio19
Spring Boot 2.1 & JUnit Jupiter – Custom
Config
@Target(TYPE)
@Retention(RUNTIME)
// @ExtendWith(SpringExtension.class)
@SpringBootTest
@AutoConfigureMockMvc
@Transactional
public @interface SpringEventsWebTest {
}
• @SpringBootTest + @AutoConfigureMockMvc +
@ExtendWith(SpringExtension.class)
62@sam_brannen #JUnit5 #springio19
Spring Boot 2.1 & JUnit Jupiter – MockMvc
Test
@SpringEventsWebTest
class EventsControllerTests {
@Test
@DisplayName("Home page should display more than 10 events")
void listEvents(@Autowired MockMvc mockMvc) throws Exception {
mockMvc.perform(get("/"))
.andExpect(view().name("event/list"))
.andExpect(model().attribute("events",
hasSize(greaterThan(10))));
}
}
• @SpringEventsWebTest + method-level DI + MockMvc
63@sam_brannen #JUnit5 #springio19
Tip: Upgrading JUnit 5 Version in Spring Boot
• Popular question…
• https://stackoverflow.com/a/54605523/388980
• Gradle:
ext['junit-jupiter.version']='5.4.2'
• Maven:
<properties>
<junit-jupiter.version>5.4.2</junit-jupiter.version>
</properties>
DEMO
Spring Boot 2.2 M3
Getting Involved
66@sam_brannen #JUnit5 #springio19
How can I help out?
• Participate on GitHub
• Report issues
• Suggest new features
• Participate in discussions
• Answer questions on Stack Overflow and Gitter
• Support the JUnit Team with donations via Steady HQ
https://steadyhq.com/en/junit
In closing…
68@sam_brannen #JUnit5 #springio19
JUnit 5 Resources
Project Homepage  http://junit.org/junit5
User Guide  http://junit.org/junit5/docs/current/user-guide
Javadoc  http://junit.org/junit5/docs/current/api
GitHub  https://github.com/junit-team
Gitter  https://gitter.im/junit-team/junit5
Stack Overflow  http://stackoverflow.com/tags/junit5
69@sam_brannen #JUnit5 #springio19
Demos Used in this Presentation
https://github.com/sbrannen/junit5-demo
https://github.com/junit-team/junit5/tree/master/documentation/src/test
Sam Brannen
@sam_brannen
Thanks!
Q&A

More Related Content

What's hot

Test Automation
Test AutomationTest Automation
Test Automation
Rodrigo Paiva
 
Unit Testing Android Applications
Unit Testing Android ApplicationsUnit Testing Android Applications
Unit Testing Android Applications
Rody Middelkoop
 
Codeception: introduction to php testing
Codeception: introduction to php testingCodeception: introduction to php testing
Codeception: introduction to php testing
Engineor
 
Spring Test Framework
Spring Test FrameworkSpring Test Framework
Spring Test Framework
GlobalLogic Ukraine
 
Keyword Driven Testing
Keyword Driven TestingKeyword Driven Testing
Keyword Driven TestingMaveryx
 
Mobile Testing with Selenium 2 by Jason Huggins
Mobile Testing with Selenium 2 by Jason HugginsMobile Testing with Selenium 2 by Jason Huggins
Mobile Testing with Selenium 2 by Jason Huggins
Sauce Labs
 
A journey with Target Platforms
A journey with Target PlatformsA journey with Target Platforms
A journey with Target Platforms
Mickael Istria
 
Acceptance testing in php with Codeception - Techmeetup Edinburgh
Acceptance testing in php with Codeception - Techmeetup EdinburghAcceptance testing in php with Codeception - Techmeetup Edinburgh
Acceptance testing in php with Codeception - Techmeetup Edinburgh
Engineor
 
Codeception
CodeceptionCodeception
Codeception
Jonathan Lau
 
PHP Unit Testing in Yii
PHP Unit Testing in YiiPHP Unit Testing in Yii
PHP Unit Testing in Yii
IlPeach
 
Unit & integration testing
Unit & integration testingUnit & integration testing
Unit & integration testing
Pavlo Hodysh
 
Advanced Selenium Workshop
Advanced Selenium WorkshopAdvanced Selenium Workshop
Advanced Selenium Workshop
Clever Moe
 
The Test way
The Test wayThe Test way
The Test way
Mikhail Grinfeld
 
Unit Testing Your Application
Unit Testing Your ApplicationUnit Testing Your Application
Unit Testing Your Application
Paladin Web Services
 
Oh so you test? - A guide to testing on Android from Unit to Mutation
Oh so you test? - A guide to testing on Android from Unit to MutationOh so you test? - A guide to testing on Android from Unit to Mutation
Oh so you test? - A guide to testing on Android from Unit to Mutation
Paul Blundell
 
Ant Unit Your Functional Test
Ant Unit Your Functional TestAnt Unit Your Functional Test
Ant Unit Your Functional Test
jimmy zhao
 
Codeception Testing Framework -- English #phpkansai
Codeception Testing Framework -- English #phpkansaiCodeception Testing Framework -- English #phpkansai
Codeception Testing Framework -- English #phpkansai
Florent Batard
 
664 eclipse plugin
664 eclipse plugin664 eclipse plugin
664 eclipse pluginarnamoy10
 
Integration Testing in Python
Integration Testing in PythonIntegration Testing in Python
Integration Testing in Python
Panoptic Development, Inc.
 

What's hot (20)

Test Automation
Test AutomationTest Automation
Test Automation
 
Unit Testing Android Applications
Unit Testing Android ApplicationsUnit Testing Android Applications
Unit Testing Android Applications
 
Codeception: introduction to php testing
Codeception: introduction to php testingCodeception: introduction to php testing
Codeception: introduction to php testing
 
Spring Test Framework
Spring Test FrameworkSpring Test Framework
Spring Test Framework
 
Codeception
CodeceptionCodeception
Codeception
 
Keyword Driven Testing
Keyword Driven TestingKeyword Driven Testing
Keyword Driven Testing
 
Mobile Testing with Selenium 2 by Jason Huggins
Mobile Testing with Selenium 2 by Jason HugginsMobile Testing with Selenium 2 by Jason Huggins
Mobile Testing with Selenium 2 by Jason Huggins
 
A journey with Target Platforms
A journey with Target PlatformsA journey with Target Platforms
A journey with Target Platforms
 
Acceptance testing in php with Codeception - Techmeetup Edinburgh
Acceptance testing in php with Codeception - Techmeetup EdinburghAcceptance testing in php with Codeception - Techmeetup Edinburgh
Acceptance testing in php with Codeception - Techmeetup Edinburgh
 
Codeception
CodeceptionCodeception
Codeception
 
PHP Unit Testing in Yii
PHP Unit Testing in YiiPHP Unit Testing in Yii
PHP Unit Testing in Yii
 
Unit & integration testing
Unit & integration testingUnit & integration testing
Unit & integration testing
 
Advanced Selenium Workshop
Advanced Selenium WorkshopAdvanced Selenium Workshop
Advanced Selenium Workshop
 
The Test way
The Test wayThe Test way
The Test way
 
Unit Testing Your Application
Unit Testing Your ApplicationUnit Testing Your Application
Unit Testing Your Application
 
Oh so you test? - A guide to testing on Android from Unit to Mutation
Oh so you test? - A guide to testing on Android from Unit to MutationOh so you test? - A guide to testing on Android from Unit to Mutation
Oh so you test? - A guide to testing on Android from Unit to Mutation
 
Ant Unit Your Functional Test
Ant Unit Your Functional TestAnt Unit Your Functional Test
Ant Unit Your Functional Test
 
Codeception Testing Framework -- English #phpkansai
Codeception Testing Framework -- English #phpkansaiCodeception Testing Framework -- English #phpkansai
Codeception Testing Framework -- English #phpkansai
 
664 eclipse plugin
664 eclipse plugin664 eclipse plugin
664 eclipse plugin
 
Integration Testing in Python
Integration Testing in PythonIntegration Testing in Python
Integration Testing in Python
 

Similar to JUnit 5: What's New and What's Coming - Spring I/O 2019

#jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's ...
#jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's ...#jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's ...
#jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's ...
Toshiaki Maki
 
JUnit 5 Extensions
JUnit 5 ExtensionsJUnit 5 Extensions
JUnit 5 Extensions
Marc Philipp
 
Testing with JUnit 5 and Spring
Testing with JUnit 5 and SpringTesting with JUnit 5 and Spring
Testing with JUnit 5 and Spring
VMware Tanzu
 
An Introduction to JUnit 5 and how to use it with Spring boot tests and Mockito
An Introduction to JUnit 5 and how to use it with Spring boot tests and MockitoAn Introduction to JUnit 5 and how to use it with Spring boot tests and Mockito
An Introduction to JUnit 5 and how to use it with Spring boot tests and Mockito
shaunthomas999
 
Renaissance of JUnit - Introduction to JUnit 5
Renaissance of JUnit - Introduction to JUnit 5Renaissance of JUnit - Introduction to JUnit 5
Renaissance of JUnit - Introduction to JUnit 5
Jimmy Lu
 
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
 
Getting Started with Test-Driven Development at Longhorn PHP 2023
Getting Started with Test-Driven Development at Longhorn PHP 2023Getting Started with Test-Driven Development at Longhorn PHP 2023
Getting Started with Test-Driven Development at Longhorn PHP 2023
Scott Keck-Warren
 
[Webinar] Qt Test-Driven Development Using Google Test and Google Mock
[Webinar] Qt Test-Driven Development Using Google Test and Google Mock[Webinar] Qt Test-Driven Development Using Google Test and Google Mock
[Webinar] Qt Test-Driven Development Using Google Test and Google Mock
ICS
 
J Unit
J UnitJ Unit
Mini-Training: TypeScript
Mini-Training: TypeScriptMini-Training: TypeScript
Mini-Training: TypeScript
Betclic Everest Group Tech Team
 
Test Driven Development with JavaFX
Test Driven Development with JavaFXTest Driven Development with JavaFX
Test Driven Development with JavaFX
Hendrik Ebbers
 
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
 
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
 
Mule Testing in Mulesfoft 4.X
Mule Testing in Mulesfoft 4.XMule Testing in Mulesfoft 4.X
Mule Testing in Mulesfoft 4.X
Amit Singh
 
iPOJO - The Simple Life - Richard Hall, Visiting Assistant Professor at Tufts...
iPOJO - The Simple Life - Richard Hall, Visiting Assistant Professor at Tufts...iPOJO - The Simple Life - Richard Hall, Visiting Assistant Professor at Tufts...
iPOJO - The Simple Life - Richard Hall, Visiting Assistant Professor at Tufts...
mfrancis
 
Testing Rest with Spring by Kostiantyn Baranov (Senior Software Engineer, Gl...
Testing Rest with Spring  by Kostiantyn Baranov (Senior Software Engineer, Gl...Testing Rest with Spring  by Kostiantyn Baranov (Senior Software Engineer, Gl...
Testing Rest with Spring by Kostiantyn Baranov (Senior Software Engineer, Gl...
GlobalLogic Ukraine
 
The future of testing in Pharo
The future of testing in PharoThe future of testing in Pharo
The future of testing in Pharo
Pharo
 
The future of testing in Pharo
The future of testing in PharoThe future of testing in Pharo
The future of testing in Pharo
JulienDelp
 
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
 
QA Best Practices
QA  Best PracticesQA  Best Practices
QA Best Practices
James York
 

Similar to JUnit 5: What's New and What's Coming - Spring I/O 2019 (20)

#jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's ...
#jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's ...#jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's ...
#jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's ...
 
JUnit 5 Extensions
JUnit 5 ExtensionsJUnit 5 Extensions
JUnit 5 Extensions
 
Testing with JUnit 5 and Spring
Testing with JUnit 5 and SpringTesting with JUnit 5 and Spring
Testing with JUnit 5 and Spring
 
An Introduction to JUnit 5 and how to use it with Spring boot tests and Mockito
An Introduction to JUnit 5 and how to use it with Spring boot tests and MockitoAn Introduction to JUnit 5 and how to use it with Spring boot tests and Mockito
An Introduction to JUnit 5 and how to use it with Spring boot tests and Mockito
 
Renaissance of JUnit - Introduction to JUnit 5
Renaissance of JUnit - Introduction to JUnit 5Renaissance of JUnit - Introduction to JUnit 5
Renaissance of JUnit - Introduction to JUnit 5
 
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
 
Getting Started with Test-Driven Development at Longhorn PHP 2023
Getting Started with Test-Driven Development at Longhorn PHP 2023Getting Started with Test-Driven Development at Longhorn PHP 2023
Getting Started with Test-Driven Development at Longhorn PHP 2023
 
[Webinar] Qt Test-Driven Development Using Google Test and Google Mock
[Webinar] Qt Test-Driven Development Using Google Test and Google Mock[Webinar] Qt Test-Driven Development Using Google Test and Google Mock
[Webinar] Qt Test-Driven Development Using Google Test and Google Mock
 
J Unit
J UnitJ Unit
J Unit
 
Mini-Training: TypeScript
Mini-Training: TypeScriptMini-Training: TypeScript
Mini-Training: TypeScript
 
Test Driven Development with JavaFX
Test Driven Development with JavaFXTest Driven Development with JavaFX
Test Driven Development with JavaFX
 
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
 
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
 
Mule Testing in Mulesfoft 4.X
Mule Testing in Mulesfoft 4.XMule Testing in Mulesfoft 4.X
Mule Testing in Mulesfoft 4.X
 
iPOJO - The Simple Life - Richard Hall, Visiting Assistant Professor at Tufts...
iPOJO - The Simple Life - Richard Hall, Visiting Assistant Professor at Tufts...iPOJO - The Simple Life - Richard Hall, Visiting Assistant Professor at Tufts...
iPOJO - The Simple Life - Richard Hall, Visiting Assistant Professor at Tufts...
 
Testing Rest with Spring by Kostiantyn Baranov (Senior Software Engineer, Gl...
Testing Rest with Spring  by Kostiantyn Baranov (Senior Software Engineer, Gl...Testing Rest with Spring  by Kostiantyn Baranov (Senior Software Engineer, Gl...
Testing Rest with Spring by Kostiantyn Baranov (Senior Software Engineer, Gl...
 
The future of testing in Pharo
The future of testing in PharoThe future of testing in Pharo
The future of testing in Pharo
 
The future of testing in Pharo
The future of testing in PharoThe future of testing in Pharo
The future of testing in Pharo
 
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
 
QA Best Practices
QA  Best PracticesQA  Best Practices
QA Best Practices
 

More from Sam Brannen

Testing with Spring: An Introduction
Testing with Spring: An IntroductionTesting with Spring: An Introduction
Testing with Spring: An Introduction
Sam Brannen
 
Testing with Spring 4.x
Testing with Spring 4.xTesting with Spring 4.x
Testing with Spring 4.x
Sam Brannen
 
Spring Framework 4.1
Spring Framework 4.1Spring Framework 4.1
Spring Framework 4.1
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
 
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 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
 
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
 

More from Sam Brannen (20)

Testing with Spring: An Introduction
Testing with Spring: An IntroductionTesting with Spring: An Introduction
Testing with Spring: An Introduction
 
Testing with Spring 4.x
Testing with Spring 4.xTesting with Spring 4.x
Testing with Spring 4.x
 
Spring Framework 4.1
Spring Framework 4.1Spring Framework 4.1
Spring Framework 4.1
 
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
 
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 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
 
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
 

Recently uploaded

A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
kalichargn70th171
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Anthony Dahanne
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
Srikant77
 
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
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
IES VE
 
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
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
AMB-Review
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
Tendenci - The Open Source AMS (Association Management Software)
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
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
 
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
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
Globus
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
vrstrong314
 
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
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 

Recently uploaded (20)

A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
 
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...
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
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
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
 
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
 
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
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
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
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 

JUnit 5: What's New and What's Coming - Spring I/O 2019

  • 2. 2@sam_brannen #JUnit5 #springio19 Sam Brannen • Principal Software Engineer • Java Developer for over 20 years • Spring Framework Core Committer since 2007 • JUnit 5 Core Committer since October 2015
  • 3. @sam_brannen #JUnit5 #springio19 3 Agenda JUnit 5 JUnit Jupiter Migrating from JUnit 4 New Features since 5.0 Roadmap Spring and JUnit Jupiter Q & A
  • 6. P L A T F O R M J U P I T E RV I N T A G E P A R T Y T H I R D
  • 7. 7@sam_brannen #JUnit5 #springio19 JUnit 5 = Platform + Jupiter + Vintage • JUnit Platform • Foundation for launching testing frameworks on the JVM • Launcher and TestEngine APIs • ConsoleLauncher • JUnit Jupiter • New programming model & extension model for JUnit 5 • JUnit Vintage • TestEngine for running JUnit 3 & JUnit 4 based tests Revolutionary Evolutionary Necessary
  • 8. 8@sam_brannen #JUnit5 #springio19 In a Nutshell, JUnit 5 is … • Complete rewrite of JUnit • Improving on what JUnit 4 had to offer • With extensibility in mind • Modular, Extensible, & Modern • Forward and backward compatible • JUnit Platform supports JUnit 3.8, JUnit 4, and JUnit Jupiter • Plus support for any TestEngine imaginable
  • 9. 9@sam_brannen #JUnit5 #springio19 Third-party TestEngines • Specsy • Spek • Cucumber • Drools Scenario • jqwik source: https://github.com/junit-team/junit5/wiki/Third-party-Extensions
  • 10. 10@sam_brannen #JUnit5 #springio19 Java Versions Baseline • AUTOMATIC-MODULE-NAM E • module-path scanning Building and testi ng against 11 and 12
  • 11. 11@sam_brannen #JUnit5 #springio19 IDEs and Build Tools • IntelliJ: since IDEA 2016.2+ • Eclipse: since Eclipse Oxygen 4.7.1a+ • NetBeans: since Apache NetBeans 10.0 • Gradle: official test task support since Gradle 4.6 • Maven: official support since Maven Surefire 2.22.0 • Ant: junitlauncher task since Ant 1.10.3 See user guide and sample apps for examples
  • 12. 12@sam_brannen #JUnit5 #springio19 Releases Version Date 5.0.0 September 10th, 2017 5.1.0 February 18th, 2018 5.2.0 April 29th, 2018 5.3.0 September 3rd, 2018 5.4.0 February 7th, 2019 5.4.2 April 7th, 2019
  • 13. So, what is JUnit Jupiter?
  • 14. 14@sam_brannen #JUnit5 #springio19 In a Nutshell, JUnit Jupiter is … “The new programming model and extension model in JUnit 5” • Programming Model • How you write tests • Annotations • Assertions • Assumptions • Types of tests • Extension Model • How you and third parties extend the framework • Spring, Mockito, Selenium, …
  • 15. 15@sam_brannen #JUnit5 #springio19 More Powerful Programming Model What you can do with JUnit Jupiter that you can’t do with JUnit 4. • Visibility • Everything does not have to be public • Custom display names • @DisplayName: spaces, special characters, emoji 😱 • DisplayNameGenerator (since 5.4) • Tagging • @Tag replaces experimental @Category • Tag Expression Language (since 5.1)
  • 16. 16@sam_brannen #JUnit5 #springio19 Example: CalculatorTests @DisplayName("Calculator Unit Tests") class CalculatorTests { private final Calculator calculator = new Calculator(); @Test @DisplayName("➕") void add() { assertEquals(5, calculator.add(2, 3), () -> "2 + 3 = " + (2 + 3)); } // ... }
  • 17. 17@sam_brannen #JUnit5 #springio19 Expected Exceptions @Test @DisplayName("n ➗ 0 → ArithmeticException") void divideByZero() { Exception exception = assertThrows(ArithmeticException.class, () -> calculator.divide(1, 0)); assertEquals("/ by zero", exception.getMessage()); }
  • 18. 18@sam_brannen #JUnit5 #springio19 Timeouts @Test @DisplayName("Ensure Fibonacci computation is 'fast enough'") void fibonacci() { // assertTimeout(ofMillis(1000), // () -> calculator.fibonacci(30)); assertTimeoutPreemptively(ofMillis(1000), () -> calculator.fibonacci(30)); }
  • 20. 20@sam_brannen #JUnit5 #springio19 Even More Power and Expressiveness • Meta-annotation support • Create your own custom composed annotations • Combine annotations from Spring and JUnit • Conditional test execution • Dependency injection for constructors and methods • Lambda expressions and method references • Interface default methods and testing traits • @Nested test classes • @RepeatedTest, @ParameterizedTest, @TestFactory • @TestInstance lifecycle management
  • 21. Tagging & Custom Annotations
  • 22. 22@sam_brannen #JUnit5 #springio19 Tagging @Tag("fast") @Test void myFastTest() { } • Declare @Tag on a test interface, class, or method
  • 23. 23@sam_brannen #JUnit5 #springio19 Custom Tags @Target(METHOD) @Retention(RUNTIME) @Tag("fast") public @interface Fast { } • Declare @Tag as a meta-annotation @Fast @Test void myFastTest() {}
  • 24. 24@sam_brannen #JUnit5 #springio19 Composed Tags @Target(METHOD) @Retention(RUNTIME) @Tag("fast") @Test public @interface FastTest { } • Declare @Tag as a meta-annotation with other annotations (JUnit, Spring, etc.) @FastTest void myFastTest() {}
  • 26. 26@sam_brannen #JUnit5 #springio19 @RepeatedTest @RepeatedTest(5) void repeatedTest(RepetitionInfo repetitionInfo) { assertEquals(5, repetitionInfo.getTotalRepetitions()); } @RepeatedTest( value = 5, name = "Wiederholung {currentRepetition} von {totalRepetitions}" ) void repeatedTestInGerman() { // ... }
  • 27. 27@sam_brannen #JUnit5 #springio19 Parameterized Tests (junit-jupiter-params) • Annotate a method with @ParameterizedTest instead of @Test o and specify the source of the arguments o optionally override the display name • Sources o @ValueSource: char, short, byte, int, long, float, double, String, Class o @NullSource, @EmptySource, and @NullAndEmptySource (since 5.4) o @EnumSource o @MethodSource o @CsvSource & @CsvFileSource o @ArgumentsSource & custom ArgumentsProvider
  • 28. 28@sam_brannen #JUnit5 #springio19 Argument Conversion and Aggregation • Implicit conversion o Primitive types and their wrappers o Enums o File, URL, Currency, Locale, … o java.time types (JSR-310) o factory constructor or static factory method • Explicit conversion o @ConvertWith and custom ArgumentConverter o @JavaTimeConversionPattern built-in support for JSR-310 • Argument Aggregation (since 5.2) o Arguments and ArgumentAggregator
  • 29. 29@sam_brannen #JUnit5 #springio19 @ParameterizedTest – @ValueSource @ParameterizedTest @ValueSource(strings = { "mom", "dad", "radar", "racecar", "able was I ere I saw elba" }) void palindromes(String candidate) { assertTrue(isPalindrome(candidate)); }
  • 30. 30@sam_brannen #JUnit5 #springio19 @ParameterizedTest – @MethodSource @ParameterizedTest @MethodSource // ("palindromes") void palindromes(String candidate) { assertTrue(isPalindrome(candidate)); } static Stream<String> palindromes() { return Stream.of("mom", "dad", "radar", "racecar", "able was I ere I saw elba"); }
  • 31. 31@sam_brannen #JUnit5 #springio19 Dynamic Tests @TestFactory Stream<DynamicTest> dynamicTestsFromIntStream() { // Generates tests for the first 10 even integers. return IntStream.iterate(0, n -> n + 2) .limit(10) .mapToObj(n -> dynamicTest("test" + n, () -> assertTrue(n % 2 == 0))); }
  • 34. 34@sam_brannen #JUnit5 #springio19 Configuring Parallelism (5.3) • Set junit.jupiter.execution.parallel.enabled config param to true o in junit-platform.properties o via Launcher API o as JVM system property • Configure the junit.jupiter.execution.parallel.config.strategy o dynamic (the default) o fixed o custom
  • 35. 35@sam_brannen #JUnit5 #springio19 Execution Mode and Synchronization (5.3) • Disable parallel execution on a per test basis o @Execution(SAME_THREAD) // or CONCURRENT • Control synchronization o @ResourceLock("myResource") // default READ_WRITE o @ResourceLock(value = "myResource", mode = READ)
  • 38. 38@sam_brannen #JUnit5 #springio19 New Extension Model • Extension • marker interface • org.junit.jupiter.api.extension • package containing all extension APIs • implement as many as you like • @ExtendWith(...) • used to register one or more extensions • interface, class, or method level o or as a meta-annotation • @RegisterExtension • programmatic registration via fields (since 5.1)
  • 39. 39@sam_brannen #JUnit5 #springio19 Extension APIs – Lifecycle Callbacks • BeforeAllCallback • BeforeEachCallback • BeforeTestExecutionCallback • AfterTestExecutionCallback • AfterEachCallback • AfterAllCallback Extensions wrap user-supplied lifecycle methods and test methods
  • 40. 40@sam_brannen #JUnit5 #springio19 Extension APIs – Miscellaneous • ExecutionCondition • TestInstanceFactory (since 5.3) • TestInstancePostProcessor • ParameterResolver • TestTemplateInvocationContextProvider • TestExecutionExceptionHandler • TestWatcher (since 5.4) • DisplayNameGenerator (since 5.4) • MethodOrderer (since 5.4) Dependency Injectio n Applied during the discovery phase
  • 41. 41@sam_brannen #JUnit5 #springio19 DisplayNameGenerator (5.4) • SPI for generating custom display names for classes and methods • Configured via @DisplayNameGeneration • Implement your own • Or use a built-in implementation: • Standard: default behavior • ReplaceUnderscores: replaces underscores with spaces
  • 42. 42@sam_brannen #JUnit5 #springio19 MethodOrderer (5.4) • API for controlling test method execution order • Configured via @TestMethodOrder • Implement your own • Or use a built-in implementation: • Alphanumeric: sorted alphanumerically • OrderAnnotation: sorted based on @Order • Random: pseudo-random ordering
  • 43. What’s the significance of @Disabled?
  • 44. 44@sam_brannen #JUnit5 #springio19 Conditional Test Execution • Extension Model meets Programming Model • ExecutionCondition • @Disabled • DisabledCondition • eating our own dog food ;-) • Deactivate via Launcher, JVM system property, or the junit-platform.properties file • junit.conditions.deactivate = org.junit.* Game Changer
  • 45. 45@sam_brannen #JUnit5 #springio19 Built-in Conditions (5.1) • @Disabled (since 5.0) • @EnabledIf / @DisabledIf (may soon be deprecated) • @EnabledOnJre / @DisabledOnJre • @EnabledOnOs / @DisabledOnOs • @EnabledIfSystemProperty / @DisabledIfSystemProperty • @EnabledIfEnvironmentVariable / @DisabledIfEnvironmentVariable
  • 47. 47@sam_brannen #JUnit5 #springio19 Do I have to migrate from JUnit 4 to JUnit 5? • Yes and No… • You can run JUnit 4 tests on the JUnit Platform via the VintageTestEngine • You can run JUnit 4 tests alongside JUnit Jupiter tests o In the same project • You can gradually migrate existing JUnit 4 tests to JUnit Jupiter o if you want to o or… you can just write all new tests in JUnit Jupiter
  • 48. 48@sam_brannen #JUnit5 #springio19 Annotations, Assertions, Assumptions • @org.junit.Test  @org.junit.jupiter.api.Test • @Ignore  @Disabled • @BeforeClass / @AfterClass  @BeforeAll / @AfterAll • @Before / @After  @BeforeEach / @AfterEach • org.junit.Assert  org.junit.jupiter.api.Assertions • org.junit.Assume  org.junit.jupiter.api.Assumptions Failure message n ow comes LAST!
  • 49. 49@sam_brannen #JUnit5 #springio19 JUnit 4 Rule Migration Support • @EnableRuleMigrationSupport o located in experimental junit-jupiter-migrationsupport module o registers 3 extensions for JUnit Jupiter • ExternalResourceSupport o TemporaryFolder, etc. • VerifierSupport o ErrorCollector, etc. • ExpectedExceptionSupport o ExpectedException
  • 50. 50@sam_brannen #JUnit5 #springio19 JUnit 4 @Ignore and Assumption Support (5.4) • @EnableJUnit4MigrationSupport o registers the IgnoreCondition o supports @Ignore analogous to @Disabled o includes @EnableRuleMigrationSupport semantics • JUnit Jupiter supports JUnit 4 assumptions o methods in org.junit.Assume o AssumptionViolatedException
  • 52. 52@sam_brannen #JUnit5 #springio19 New Features since 5.0 • JUnit Maven BOM • Parallel test execution • Output capture for System.out and System.err • Tag expression language • Custom test sources for dynamic tests • Improved Kotlin support • Numerous enhancements for parameterized tests • Built-in @Enable* / @Disable* conditions • @RegisterExtension • TestInstanceFactory • …
  • 53. 53@sam_brannen #JUnit5 #springio19 New Features since 5.4 • New junit-jupiter dependency aggregating artifact • XML report generating listener • Test Kit for testing engines and extensions • null and empty argument sources for @ParameterizedTest methods • @TempDir support for temporary directories • DisplayNameGenerator SPI • TestWatcher extension API • Ordering for @Test methods and @RegisterExtension fields • Improved JUnit 4 migration support for assumptions and @Ignore • …
  • 55. 55@sam_brannen #JUnit5 #springio19 Coming in JUnit 5.5 • Boolean values in @ValueSource • Repeatable annotations for built-in conditions • Declarative, preemptive timeouts for tests in JUnit Jupiter • New InvocationInterceptor extension API • execution in a user-defined thread • Configurable test discovery implementation for test engines • …
  • 56. 56@sam_brannen #JUnit5 #springio19 The 5.x Backlog • Custom ClassLoader • Programmatic extension management • Declarative and programmatic test suites for the JUnit Platform • Parameterized test classes • Scenario tests • New XML / JSON reporting format • …
  • 57. Spring and JUnit Jupiter
  • 58. 58@sam_brannen #JUnit5 #springio19 Spring Support for JUnit Jupiter • Fully integrated in Spring Framework 5.0! • Supports all Core Spring TestContext Framework features • Constructor and method injection via @Autowired, @Qualifier, @Value • Conditional test execution via SpEL expressions • ApplicationContext configuration annotations • Also works with Spring Framework 4.3 https://github.com/sbrannen/spring-test-junit5
  • 59. 59@sam_brannen #JUnit5 #springio19 Configuring JUnit Jupiter with Spring • SpringExtension • @ExtendWith(SpringExtension.class) • @SpringJUnitConfig • @ContextConfiguration + SpringExtension • @SpringJUnitWebConfig • @SpringJUnitConfig + @WebAppConfiguration • @EnabledIf / @DisabledIf • SpEL expression evaluation for conditional execution
  • 60. 60@sam_brannen #JUnit5 #springio19 Automatic Test Constructor Autowiring (5.2) • By default, a test class constructor must be annotated with @Autowired • The ”default” can be changed • set spring.test.constructor.autowire=true • JVM system property or SpringProperties mechanism • @TestConstructor(autowire = true/false) • Overrides default on a per-class basis
  • 61. 61@sam_brannen #JUnit5 #springio19 Spring Boot 2.1 & JUnit Jupiter – Custom Config @Target(TYPE) @Retention(RUNTIME) // @ExtendWith(SpringExtension.class) @SpringBootTest @AutoConfigureMockMvc @Transactional public @interface SpringEventsWebTest { } • @SpringBootTest + @AutoConfigureMockMvc + @ExtendWith(SpringExtension.class)
  • 62. 62@sam_brannen #JUnit5 #springio19 Spring Boot 2.1 & JUnit Jupiter – MockMvc Test @SpringEventsWebTest class EventsControllerTests { @Test @DisplayName("Home page should display more than 10 events") void listEvents(@Autowired MockMvc mockMvc) throws Exception { mockMvc.perform(get("/")) .andExpect(view().name("event/list")) .andExpect(model().attribute("events", hasSize(greaterThan(10)))); } } • @SpringEventsWebTest + method-level DI + MockMvc
  • 63. 63@sam_brannen #JUnit5 #springio19 Tip: Upgrading JUnit 5 Version in Spring Boot • Popular question… • https://stackoverflow.com/a/54605523/388980 • Gradle: ext['junit-jupiter.version']='5.4.2' • Maven: <properties> <junit-jupiter.version>5.4.2</junit-jupiter.version> </properties>
  • 66. 66@sam_brannen #JUnit5 #springio19 How can I help out? • Participate on GitHub • Report issues • Suggest new features • Participate in discussions • Answer questions on Stack Overflow and Gitter • Support the JUnit Team with donations via Steady HQ https://steadyhq.com/en/junit
  • 68. 68@sam_brannen #JUnit5 #springio19 JUnit 5 Resources Project Homepage  http://junit.org/junit5 User Guide  http://junit.org/junit5/docs/current/user-guide Javadoc  http://junit.org/junit5/docs/current/api GitHub  https://github.com/junit-team Gitter  https://gitter.im/junit-team/junit5 Stack Overflow  http://stackoverflow.com/tags/junit5
  • 69. 69@sam_brannen #JUnit5 #springio19 Demos Used in this Presentation https://github.com/sbrannen/junit5-demo https://github.com/junit-team/junit5/tree/master/documentation/src/test