Description
In this course, you will learn :
- We'll start with some setup to build a project where we can write our tests and allow the use of JUnit 5 in the project.
- Begin by building a few very basic tests, followed by an introduction to the framework's so-called lifecycle methods, or before and afters.
- The following chapters will demonstrate how to run the same code from a test method but with different values supplied to the function via parameter values.
- Explore how to provide values for those parameters in JUnit 5 in a variety of ways.
- how to run our tests in the desired sequence.
- look into assumptions, which are an interesting element of this framework: code runs only when specific circumstances are met.
- how to enable and disable tests based on specific situations.
- look at how to repeat tests, which means running the same test multiple times.
- Then, in the next chapter, we'll look at how to add tags to our tests, allowing us to select them based on their tags and execute them for specific purposes, such as CI jobs or feature testing.
- We will introduce assertions in chapters 13 and 14, beginning with JUnit 5 specific assertions.
- After that, we'll look at how to leverage assertions from an external library, in this example, Hamcrest.
- We'll then go into greater detail on how to perform the tests.
- See how to extract some data from the test run in order to generate relevant testing reports.
- Briefly discuss timeouts for tests, also known as nested tests, which are inner tests for our test classes, as well as how to make our own composed annotations.
- Look at how to migrate from JUnit 4 if we are utilizing that version of the library in our project.
Syllabus:
- Setup JUnit 5
- Writing Tests
- Lifecycle Methods
- Parameterized Tests with @ValueSource
- Parameterized Tests with @CsvSource
- Parameterized Tests witth @CsvFileSource
- Parameterized Tests with @MethodSource
- Test Run Order
- Assumptions
- Disabling Tests
- Repeating Tests
- Tags
- Assertions
- Hamcrest
- Running Tests
- Test Watcher
- Timeouts, Nested Tests, and Custom Annotations
- Migrating from JUnit 4