Writing JUnit 5 Tests
Writing JUnit 5 Tests
See Also - Marco Codes
In addition to this tutorial, we recommend you check out Marco Codes - JUnit Tutorial - Crash Course to learn how to use JUnit 5 like a professional including:
- Understand what Maven/Gradle dependencies you'll need
- How to write tests
- How to use other assertion libraries like AssertJ and asserting JSON & XML
- Explore new JUnit 5 features like @ParameterizedTests, @TestFactorys, and @ExtendWith
Introduction
Introduction to writing JUnit 5 Tests
Setting up Gradle for JUnit 5
Laying the foundations for Writing JUnit 5 Tests
Creating and running a test
Getting a JUnit 5 Test running
Optional Configuration
Configure parameters and how tests are run
Disabling or Ignoring Tests
Using JUnit 5 annotations to disable tests
Helpful Test Names for Display
Making your code more readable
Live Templates Tip
Use Live Templates to create tests faster
Multiple Assertions
Managing the situation where you have to check more than one assertion
Test Assumptions
Writing your test assumptions
Data Driven Tests
Using parameterised tests
Checking Exceptions
Testing that exceptions are correctly thrown
Grouping Tests
Writing nested tests
Shortcuts
Shortcuts used in the tutorial