JUnit
The standard testing framework for Java, which discovers methods marked @Test, runs them and reports each failure with the test's name.
In more detail
JUnit 5 is made of the JUnit Platform, which launches tests, and JUnit Jupiter, the programming model you write tests in. Its XML results format became the common way for continuous integration systems to read test results, so test runners in other languages can write JUnit XML too.
Examples
This course uses org.junit.jupiter:junit-jupiter:5.14.4, run by Maven Surefire and Gradle.org.junit.jupiter:junit-jupiter:5.14.4In this course: JUnit uses annotations such as @Test and tags where pytest uses markers, and has an extension for temporary directories. Build tools such as Maven and Gradle and most code editors run JUnit tests directly.Related terms
- @Test — The JUnit annotation that marks a method as a test to discover and run.
- JUnit Platform — The foundation of modern JUnit that discovers and runs tests, on which build tools and editors launch test engines such as JUnit Jupiter.
- assertion — A check that a condition is true, which stops a test or program with a failure if it is false.
- AssertJ — A Java library of fluent assertions, starting with assertThat, that read like sentences and explain failures in detail.
- unit test — An automated check of one small piece of code, such as a single function, that runs quickly and on its own.
- test reporter — The part of a test runner that formats results, for people (such as a spec list) or for tools (such as TAP or JUnit XML).
- Test Anything Protocol — A simple text format for test results, one line per test starting with ok or not ok, readable by people and tools.
- test framework — A library and set of conventions for writing, organising and running automated tests in a language.
- pytest — A popular Python testing framework that finds test functions automatically and reports failures with detailed comparisons.
Taught in
- A Testing Strategy In The Pipeline — Microsoft Azure DevOps Engineer Expert (AZ-400) Exam Prep
- The Toolchain: Maven — Modern Java: Virtual Threads & High-Throughput Services
- The Toolchain: Gradle — Modern Java: Virtual Threads & High-Throughput Services
- Async With CompletableFuture — Modern Java: Virtual Threads & High-Throughput Services
- Testing Basics With JUnit 5 — Modern Java: Virtual Threads & High-Throughput Services
- Native Test Runner: node:test & node:assert/strict — Node.js Internals & Backend Services
- The Test Pyramid And Where It Is Wrong — Automated Testing, TDD & Quality Engineering
- Introducing pytest — Automated Testing, TDD & Quality Engineering
- Testing The Filesystem — Automated Testing, TDD & Quality Engineering