Testing Spring Boot Application with JUnit and Mockito
What you'll learn
- Learn to write industry-standard Unit and Integration tests in BDD (Behaviour Driven Development) style using Spring Boot Starter Test dependency from scratch
- Learn how to use BDD (Behaviour Driven Development) format that is given/when/then to write Unit tests.
- Learn to Unit test Spring boot application Repository layer
- Learn to Unit test Spring boot application Service layer
- Learn to Unit test Spring boot application Controller layer - Unit test REST API's
- Learn how to do Integration testing for the Spring boot application
- You will learn to use the most important Unit Testing annotations - @SpringBootTest, @WebMvcTest, @DataJpaTest, and @MockBean
- Use all the frameworks in Spring Boot Starter Test - JUnit, Spring Test, Spring Boot Test, AssertJ, Hamcrest, Mockito, JSONassert, and JsonPath.
- You will learn to write Unit tests using Mocks and Stubs created with Mockito
- Learn how to use Mockito annotations to create mock objects.
- Learn to write Integration Tests using a MySQL database
- You will learn to write independent Integration tests for RESTFUL web services talking with MULTIPLE LAYERS - controller, service, and repository layers.
- Learn to write Integration Tests using a Testcontainers
Requirements
- Java programming
- Good to know JUnit and Mockito basics
- Good to know Spring Boot basics
- Basic understanding of using IntelliJ IDEA
Description
In this course, you will learn how to write Unit tests and Integration tests in BDD style for Spring Boot application using JUnit 5, Mockito, AssertJ, Hamcrest, JsonPath, and Testcontainers frameworks.
The objective of this course is to teach you how to Unit test different layers of the Spring boot application such as repository, service, and controller layers. You will also learn how to perform Integration testing using MySQL database as well as Testcontainers.
Type the code along with me in the videos. If you follow along with me then this will enhance your learning experience.
The source code and PDF files (class notes) are available for download.
Spring Boot Overview
Spring Boot is an opinionated framework that helps developers build Spring-based applications quickly and easily.
The main goal of Spring Boot is to quickly create Spring-based applications without requiring developers to write the same boilerplate configuration again and again.
Spring Boot is a very popular framework to develop REST web services and microservices.
What you'll learn?
Learn to write industry-standard Unit and Integration tests in BDD (Behaviour Driven Development) style using Spring Boot Starter Test dependency from scratch
Learn how to use BDD (Behaviour Driven Development) format that is given/when/then to write Unit tests.
Learn to Unit test Spring boot application Repository layer
Learn to Unit test Spring boot application Service layer
Learn to Unit test Spring boot application Controller layer
Learn how to do Integration testing for the Spring boot application.
Learn how to do Integration testing using Testcontainers // very important
You will learn to use the most important Unit Testing ANNOTATIONS - @SpringBootTest, @WebMvcTest, @DataJpaTest, and @MockBean
Use ALL the FRAMEWORKS in Spring Boot Starter Test - JUnit, Spring Test, Spring Boot Test, AssertJ, Hamcrest, Mockito, JSONassert, and JsonPath.
You will learn to write Unit tests using Mocks and Stubs created with Mockito
Learn how to use Mockito annotations to create mock objects.
Learn to Write Integration Tests using a MySQL database.
You will learn to Write INDEPENDENT Integration tests for RESTFUL web services talking with MULTIPLE LAYERS - controller, service, and repository layers.
Tools and Technologies used in this course:
Technologies and Libraries:
Java 11+
Spring Boot
Spring MVC
Spring Data JPA ( Hibernate)
JUnit 5 Framework
Mockito 4 (Latest)
Hamcrest framework
AssertJ Library
JsonPath Library
IDE:
Intellij IDEA
Database:
H2 In-memory database ( for repository layer testing)
MySQL database ( for Integration testing)
Who this course is for:
- This is course is for beginners as well as professional to teach how to write Unit and Integration tests for Spring boot application.
Instructor
Hi, I'm Ramesh Fadatare a Software Engineer with 10 years of experience in Java, Spring Boot, Microservices, Hibernate, Angular, React, and related open source technologies.
I am a Vmware Spring Certified Professional - check my blog to know more about this certification.
I am a founder and author of the top Java blog website Java Guides ( 1m views per month) - a technical blog dedicated to Java/Java EE, Spring Boot, and Full-stack Java Development.
I am YouTuber at "Java Guides" YouTube channel ( 72K Subscribers)
Published around 200+ free sample projects on GitHub (2.7K followers)