The Baeldung logo
  • The Baeldung Logo
  • Start Here
  • Courses ▼▲
    • REST with Spring

      The canonical reference for building a production grade API with Spring

    • Learn Spring Security ▼▲

      THE unique Spring Security education if you’re working with Java today

      • Learn Spring Security Core

        Focus on the Core of Spring Security 5

      • Learn Spring Security OAuth

        Focus on the new OAuth2 stack in Spring Security 5

    • Learn Spring

      From no experience to actually building stuff​

    • Learn Spring Data JPA

      The full guide to persistence with Spring Data JPA

  • Guides ▼▲
    • Persistence

      The Persistence with Spring guides

    • REST

      The guides on building REST APIs with Spring

    • Security

      The Spring Security guides

  • About ▼▲
    • Full Archive

      The high level overview of all the articles on the site.

    • Baeldung Ebooks

      Discover all of our eBooks

    • About Baeldung

      About Baeldung.

Testing

Testing is a very important aspect to building a stable application. Learn how to use different Java-based testing tools through the guides below.

  • JUnit (55)
  • Mockito (35)
  • JUnit 5 (31)
  • Mocking (12)
  • JMeter (11)
  • AssertJ (10)
  • Matchers (8)
  • Hamcrest (8)
  • Cucumber (7)
  • Selenium (6)
  • TestNG (6)
  • JMockit (6)
  • REST Assured (5)

>> Load Testing Rest Endpoint Using Gatling

>> Pitfalls on Testing with Spring Boot

>> JUnit 5 @Nested Test Classes

>> How Do I Generate a Dashboard Report in JMeter?

>> Single Assert Call for Multiple Properties in Java Unit Testing

>> Generate Unit Test Data in Java Using Instancio

>> Quick Guide to Sentry

>> Extract Values using AssertJ in Java

>> Running Multiple Thread Groups in JMeter

>> Handle Browser Tabs With Selenium

>> How to Run TestNG Tests on Jenkins

>> SpringRunner vs MockitoJUnitRunner

>> Fixing Selenium WebDriver Executable Path Error

>> Mocking a Singleton With Mockito

>> JUnit – Testing Methods That Call System.exit()

>> assertAll() vs Multiple Assertions in JUnit5

>> Introduction to Datafaker

>> Mocking Java InputStream Object

>> JMeter: Latency vs. Load Time

>> Testing Spring JMS

>> Spring Boot – Testing Redis With Testcontainers

>> Unit Test Private Methods in Java

>> How to Mock HttpServletRequest

>> Load Testing Using Postman

>> Spring Web Service Integration Tests with @WebServiceServerTest

>> Basic Authentication in JMeter

>> Apache Camel Routes Testing in Spring Boot

>> Get the Name of the Currently Executing Test in JUnit

>> Running a TestNG Project From the Command Line

>> Failed to Load ApplicationContext for JUnit Test of Spring Controller

>> CassandraUnit Test Tutorial

>> Assert that an Object is from a Specific Type

>> Best Practices For Unit Testing In Java

>> Assert That a Java Optional Has a Certain Value

>> Using Test Containers With Spring Data Cassandra

>> Parallel Test Execution for JUnit 5

>> Using Fail Assertion in JUnit

>> JUnit 4 on How to Ignore a Base Test Class

>> Run JUnit Test Cases From the Command Line

>> Running a Single Test or Method With Maven

>> Inserting Delays Between Requests in Apache JMeter

>> The java.lang.NoClassDefFoundError in JUnit

>> Difference Between Maven Surefire and Failsafe Plugins

>> Running Selenium Scripts with JMeter

>> Guide to the ModelAssert Library for JSON

>> Exclusions from Jacoco Report

>> Using Cucumber with Gradle

>> Code Coverage with SonarQube and JaCoCo

>> Fixing the NoSuchMethodError JUnit Error

>> Using Cucumber Tags with JUnit 5

>> Mocking Static Methods With Mockito

>> Introduction to ZeroCode

>> Write Extracted Data to a File Using JMeter

>> Distributed Performance Testing with Gatling

>> Overview of Mockito MockSettings

>> Integration Tests With Spring Cloud Netflix and Feign

>> Guide to the System Stubs Library

>> Testing Kafka and Spring Boot

>> Distributed Performance Testing with JMeter

>> Accessing Keycloak Endpoints Using Postman

>> @BeforeAll and @AfterAll in Non-Static Methods

>> Conditionally Run or Ignore Tests in JUnit 4

>> Guide to the System Rules Library

>> Difference Between when() and doXxx() Methods in Mockito

>> Assert Two Lists for Equality Ignoring Order in Java

>> Testing Quarkus Applications

>> Skipping Tests With Gradle

>> Using Mockito ArgumentCaptor

>> Unit Testing of System.out.println() with JUnit

>> Taking Screenshots With Selenium WebDriver

>> Testing Exceptions with Spring MockMvc

>> Test a Mock JNDI Datasource with Spring

>> Using Kafka MockProducer

>> Using Kafka MockConsumer

>> Clicking Elements in Selenium using JavaScript

>> Asserting Log Messages With JUnit

>> Mocking the ObjectMapper readValue() Method

>> The Difference Between mockito-core and mockito-all

>> How to Test GraphQL Using Postman

>> Introduction to DBUnit

>> Writing Templates for Test Cases Using JUnit 5

>> Prevent ApplicationRunner or CommandLineRunner Beans From Executing During Junit Testing

>> Spring JdbcTemplate Unit Testing

>> Testing Spring Boot @ConfigurationProperties

>> Cucumber Hooks

>> Using Cookies With Selenium WebDriver in Java

>> Cucumber Background

>> A Quick Guide to Timeouts in OkHttp

>> Run Gatling Tests From Jenkins

>> Cucumber Data Tables

>> Mockito and Fluent APIs

>> Determine the Execution Time of JUnit Tests

>> Testing a Spring Batch Job

>> File System Mocking with Jimfs

>> The Spring TestExecutionListener

>> Unable to Find @SpringBootConfiguration with @DataJpaTest

>> A Quick Guide to @DirtiesContext

>> Mocking a WebClient in Spring

>> Guide to JUnit 4 Rules

>> @TestInstance Annotation in JUnit 5

>> The Difference Between Failure and Error in JUnit

>> Embedded Redis Server with Spring Boot Test

>> Mocking a Void Method with EasyMock

>> JUnit 5 TestWatcher API

>> JUnit Custom Display Name Generator API

>> Quick Guide to EasyRandom in Java

>> Override Properties in Spring’s Tests

>> JUnit 5 Temporary Directory Support

>> Using SpringJUnit4ClassRunner with Parameterized

>> Guide to ApplicationContextRunner in Spring Boot

>> Get the Path of the /src/test/resources Directory in JUnit

>> Mockito Strict Stubbing and The UnnecessaryStubbingException

>> Tagging and Filtering JUnit Tests

>> Skipping Tests with Maven

>> REST Assured Authentication

>> Setting the Log Level in Spring Boot when Testing

>> Guide to Spock Extensions

>> REST-assured Support for Spring MockMvc

>> Getting and Verifying Response Data with REST-assured

>> Difference Between Stub, Mock, and Spy in the Spock Framework

>> JUnit 5 Conditional Test Execution with Annotations

>> Testing Web APIs with Postman Collections

>> Using WireMock Scenarios

>> DB Integration Tests with Spring Boot and Testcontainers

>> How to Test the @Scheduled Annotation

>> Guide to JUnit 5 Parameterized Tests

>> Exclude Auto-Configuration Classes in Spring Boot Tests

>> Testing Reactive Streams Using StepVerifier and TestPublisher

>> Testing with Spring and Spock

>> Gatling vs JMeter vs The Grinder: Comparing Load Test Tools

>> Guide to ReflectionTestUtils for Unit Testing

>> Mockito Tutorial

>> Mocking a RestTemplate in Spring

>> Using JUnit 5 with Gradle

>> Exploring the Jersey Test Framework

>> Warning: “The type MockitoJUnitRunner is deprecated”

>> String Not Empty Test Assertions in Java

>> A Quick Guide to @TestPropertySource

>> Spring Security for Spring Boot Integration Tests

>> Integration Testing with Maven

>> Mock Static Method using JMockit

>> Running JUnit Tests in Parallel with Maven

>> Testing an Abstract Class With JUnit

>> Running JUnit Tests Programmatically, from a Java Application

>> A Guide to JavaFaker

>> Mockito.mock() vs @Mock vs @MockBean

>> Optimizing Spring Integration Tests

>> Spring Boot Integration Testing with Embedded MongoDB

>> Testing Callbacks with Mockito

>> Learn JUnit

>> JUnit5 Programmatic Extension Registration with @RegisterExtension

>> Mockito ArgumentMatchers

>> Hamcrest Common Core Matchers

>> Testing Netty with EmbeddedChannel

>> EasyMock Argument Matchers

>> @Before vs @BeforeClass vs @BeforeEach vs @BeforeAll

>> Assert an Exception is Thrown in JUnit 4 and 5

>> Hamcrest Custom Matchers

>> Introduction to EasyMock

>> JSON Schema Validation with REST-assured

>> Headers, Cookies and Parameters with REST-assured

>> Hamcrest Object Matchers

>> Hamcrest Bean Matchers

>> REST-assured with Groovy

>> Hamcrest File Matchers

>> Hamcrest Text Matchers

>> Assertions in JUnit 4 and JUnit 5

>> Using Hamcrest Number Matchers

>> How to TDD a List Implementation in Java

>> AssertJ Exception Assertions

>> Using Conditions with AssertJ Assertions

>> Custom Assertions with AssertJ

>> Programmatic Transactions in the Spring TestContext Framework

>> Quick Guide to BDDMockito

>> Guide to JSpec

>> Configure Jenkins to Run and Show JMeter Tests

>> Intro to Performance Testing using JMeter

>> JUnit 5 @Test Annotation

>> The SpringJUnitConfig and SpringJUnitWebConfig Annotations in Spring 5

>> Mock Final Classes and Methods with Mockito

>> The Order of Tests in JUnit

>> Spring 5 Testing with @EnabledIf Annotation

>> Lazy Verification with Mockito 2

>> REST API Testing with Karate

>> Mocking of Private Methods Using PowerMock

>> JUnit5 @RunWith

>> Mockito and JUnit 5 – Using ExtendWith

>> Mocking Void Methods with Mockito

>> Mocking Exception Throwing using Mockito

>> Custom JUnit 4 Test Runners

>> Introduction to Jukito

>> Introduction to Lambda Behave

>> Inject Parameters into JUnit Jupiter Unit Tests

>> Introduction to Hoverfly in Java

>> Introduction to MockServer

>> Cucumber Java 8 Support

>> Guide to PDFUnit

>> Migrating from JUnit 4 to JUnit 5

>> Introduction to Awaitility

>> A Guide to JUnit 5 Extensions

>> Consumer Driven Contracts with Pact

>> Testing with Selenium/WebDriver and the Page Object Pattern

>> Testing with JGoTesting

>> Serenity BDD and Screenplay

>> Guide to Dynamic Tests in Junit 5

>> Introduction to Testing with Arquillian

>> Introduction to JUnitParams

>> Testing with Google Truth

>> Serenity BDD with Spring and JBehave

>> Custom Reporting with TestNG

>> A Guide to @RepeatedTest in Junit 5

>> Introduction to Serenity BDD

>> Testing in Spring Boot

>> Testing a REST API with JBehave

>> Configuring Separate Spring DataSource for Tests

>> Cucumber and Scenario Outline

>> Exploring the Spring Boot TestRestTemplate

>> Introduction to TestNG

>> Self-Contained Testing Using an In-Memory Database

>> Introduction to Testing with Spock and Groovy

>> Introduction to JSONassert

>> Property Testing Example With Vavr

>> Testing an OAuth Secured API with Spring MVC (using the Spring Security OAuth legacy stack)

>> [NEWS] AssertJ 3.6.X – Interview with Joel Costigliola

>> Concurrent Test Execution in Spring 5

>> Mockito’s Java 8 Features

>> Introduction to Cobertura

>> A Quick JUnit vs TestNG Comparison

>> Introduction to HtmlUnit

>> Guide to Selenium with JUnit / TestNG

>> A Guide to JUnit 5

>> Introduction to FindBugs

>> WebAppConfiguration in Spring Tests

>> Integration Testing in Spring

>> Cucumber Spring Integration

>> Intro to JaCoCo

>> JMockit Advanced Usage

>> Introduction To XMLUnit 2.x

>> A Guide to REST-assured

>> Quick Guide to @RestClientTest in Spring Boot

>> A Guide to JMockit Expectations

>> Mutation Testing with PITest

>> AssertJ’s Java 8 Features

>> AssertJ for Guava

>> JMockit 101

>> Testing with Hamcrest

>> Introduction to AssertJ

>> Mockito vs EasyMock vs JMockit

>> Introduction to WireMock

>> REST API Testing with Cucumber

>> Introduction to Spring REST Docs

>> Mockito’s Mock Methods

>> Introduction to PowerMock

>> Injecting Mockito Mocks into Spring Beans

>> Getting Started with Mockito @Mock, @Spy, @Captor and @InjectMocks

>> Mockito – Using Spies

>> Mockito When/Then Cookbook

>> Mockito Verify Cookbook

>> Hamcrest Collections Cookbook

>> Testing REST with multiple MIME types

>> Integration Testing with the Maven Cargo plugin

>> Test a REST API with Java

>> Avoid brittle tests for the Service layer

  • ↑ Back to Top
res – Junit (guide) (cat=Testing)
opt-in
Quick Guide to Take Advantage of JUnit 5
Download the E-book
The Baeldung logo

Courses

  • All Courses
  • All Bulk Courses
  • All Bulk Team Courses
  • The Courses Platform

Series

  • Java “Back to Basics” Tutorial
  • Jackson JSON Tutorial
  • Apache HttpClient Tutorial
  • REST with Spring Tutorial
  • Spring Persistence Tutorial
  • Security with Spring
  • Spring Reactive Tutorials

About

  • About Baeldung
  • The Full Archive
  • Editors
  • Jobs
  • Our Partners
  • Partner with Baeldung
  • Terms of Service
  • Privacy Policy
  • Company Info
  • Contact
The Baeldung Logo