Skip to main content

JUnit

JUnit 6 with Spring Boot: Unit, Slice, and Integration Testing

A complete guide to testing Spring Boot applications with JUnit 6. Covers unit tests with plain JUnit, slice tests (@WebMvcTest, @DataJpaTest, @JsonTest), full integration tests with @SpringBootTest, context caching, Testcontainers, and best practices for each layer.

Advanced Extensions in JUnit 6: Creating Custom Testing Frameworks

Advanced JUnit 6 extension patterns: composed meta-annotations, automatic retry extensions, soft assertions via ParameterResolver, and custom invocation strategies with @TestTemplate. Complete runnable examples showing how to build a domain-specific testing framework.

Build Your Own JUnit 6 Test Engine (Advanced Guide)

A step-by-step guide to building a complete, runnable custom JUnit 6 TestEngine from scratch. Covers TestDescriptor trees, the discovery and execution phases, ServiceLoader registration, and a full CSV-based test engine example with real output.

JUnit 6 Internals: How the Test Engine Works

An in-depth look at JUnit 6 internals: the two-phase discovery and execution model, the TestDescriptor tree, the EngineExecutionListener event chain, UniqueId addressing, and programmatic test plan inspection with complete runnable code examples.

Parallel Test Execution in JUnit 6: Configuration and Pitfalls

A complete guide to JUnit 6 parallel test execution: enabling and configuring parallelism, class vs method level concurrency, @Execution and @ResourceLock annotations, thread pool strategies, pitfall table with fixes, and real performance benchmarks.

JUnit 6 Extensions Model: Build Custom Extensions Step-by-Step

A step-by-step guide to building JUnit 6 extensions. Covers all extension interfaces: lifecycle callbacks, ParameterResolver, TestExecutionExceptionHandler, @RegisterExtension with configuration, the ExtensionContext.Store, and a complete interface reference table.

Tags and Test Suites in JUnit 6: Organizing Large Test Bases

A complete guide to using @Tag in JUnit 6 to categorize tests, build test suites, filter by tag at build time using Maven and Gradle, and apply tagging strategies for fast vs slow, unit vs integration, and feature-flag-based test selection.

Structuring Tests with JUnit 6 Nested Tests (Real-World Use Cases)

Learn how to use @Nested in JUnit 6 to organise tests into scenario-based inner class groups. Covers lifecycle composition, real-world patterns for REST controllers and domain services, nesting rules, and a complete ShoppingCart example with full test report output.