Testing

JVM Testing & Microbenchmark Tools

Test-driven code on the JVM rests on a durable core of tooling: a test framework (JUnit 5 or TestNG), an assertion library (AssertJ), and a mocking library (Mockito). Around that core, Testcontainers lets you spin up real infrastructure for integration tests, and JMH is the only sane way to microbenchmark code on a modern JIT-compiled JVM.

For performance and load, Gatling and k6 cover scenario-based load testing. Because the JVM's JIT compiler makes naive benchmarking meaningless, JMH deserves special attention whenever you need a measured number.

What you'll find here: Unit tests: JUnit 5, TestNG, AssertJ, Mockito · Integration tests with real containers: Testcontainers · Microbenchmarks without JIT pitfalls: JMH · Load & API testing: Gatling, k6

Testing tools

In-depth guides in this category