Testing Spring Boot App with JUnit Mockito Testcontainers

Unit tests and Integration tests for Spring Boot App using JUnit, Mockito, AssertJ, Hamcrest, JsonPath, & Testcontainers
Testing Spring Boot App with JUnit Mockito Testcontainers
File Size :
5.42 GB
Total length :
8h 28m

Category

Instructor

Ramesh Fadatare (Java Guides)

Language

Last update

1/2023

Ratings

4.5/5

Testing Spring Boot App with JUnit Mockito Testcontainers

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

Testing Spring Boot App with JUnit Mockito 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 applications using JUnit 5, Mockito, AssertJ, Hamcrest, JsonPath, and Testcontainers frameworks.Important note: This course updated to use Spring Boot 3. The objective of this course is to teach you how to Unit test different layers of the Spring boot application such as the 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 OverviewSpring 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 scratchLearn 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 layerLearn to Unit test Spring boot application Service layerLearn to Unit test Spring boot application Controller layerLearn how to do Integration testing for the Spring boot application.Learn how to do Integration testing using Testcontainers // very importantYou will learn to use the most important Unit Testing ANNOTATIONS – @SpringBootTest, @WebMvcTest, @DataJpaTest, and @MockBeanUse 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 MockitoLearn 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 BootSpring MVCSpring Data JPA ( Hibernate)JUnit 5 FrameworkMockito 4 (Latest)Hamcrest frameworkAssertJ LibraryJsonPath LibraryIDE:Intellij IDEADatabase:H2 In-memory database ( for repository layer testing)MySQL database ( for Integration testing)Amazing reviews from Students on this course:”Ramesh is a great teacher, he provides very clean explanations on complex concepts.””Ramesh explains things very well! His instructions are easy to follow and understand. The course is very beneficial””✔ Well structured course covering all layers of testing✔ Implement each method with the “right to the point” explanation✔ Nice introduction to TestContainers✔ Easy to code along✔ Fast answers from the instructorLooking for more deep dives courses such as Maven, Gradle, DevOps tools used in production””Awesome course.All the basics needed to test a spring application are discussed, and more.Exactly what i needed and coudn’t find anywhere.Ramesh is a great instructor.Thank you sir !””A very good course explained with excellent examples.Lot to learn from this course, covered every layer of a typical Spring Boot application.””I really appreciate the trainer Ramesh to providing is this amazing course,the content of this course and explanation is great.””Wonderful Sir, Loved the way u explain things. And I am very lucky that I found this course at right time.””I am personally very impressed with this course, if you dont have any prior experience of unit testing I am pretty sure that after taking this course you will feel more confident and I would be happy if the lecturer could also release some training tutorials about Microservices and TDD approach. thanks and wish you all the successes.””Even though as a experience guy, this course was very useful..””The course is great and covers all I need to create my tests.I truly recommend it .””Great course. This is the second course I am taking from Ramesh. Interesting so far.””Awesome course and highly recommend it.””This course is a good match for me. Especially so because it’s new and up to date.””great teacher and great course””Yes this is a good match for me and I am glad I enrolled for this. I personally prefer teaching of ramesh.fadatare. I started to watch his videos from YouTube and also gone through his comments to few problems in stack overflow. I thought it would be good if I can go through all his videos in one go.””this is what they ask you to do on a real job… please do more courses ramesh.. amazing as always”

Overview

Section 1: Introduction

Lecture 1 Course overview and roadmap

Lecture 2 Best Way to Take This Course and How to Get Help

Lecture 3 What is Unit testing and Integration testing?

Lecture 4 Best practices for Unit testing in Java

Lecture 5 Download Source Code

Lecture 6 Download All the Important Lecture Notes in PDF

Lecture 7 This Course Migrated to Spring Boot 3

Section 2: Spring Boot Project Setup

Lecture 8 Create and Set up Spring Boot Project in IntelliJ IDEA

Lecture 9 Understanding Spring boot starter test dependency

Lecture 10 Create JPA Entity

Lecture 11 Create Spring Data JPA repository

Section 3: Spring Boot – Unit Testing Repository Layer

Lecture 12 Repository layer Unit testing overview

Lecture 13 Spring Boot @DataJpaTest annotation

Lecture 14 Unit test for save employee operation

Lecture 15 Unit test for get all employees operation

Lecture 16 Unit test for get employee by id operation

Lecture 17 Unit test for get employee by email operation (Spring Data JPA query method)

Lecture 18 Unit test for update employee operation

Lecture 19 Unit test for delete employee operation

Lecture 20 Unit test Spring Data JPA custom query method using JPQL with index parameters

Lecture 21 Unit test Spring Data JPA custom query method using JPQL with named parameters

Lecture 22 Unit test Spring Data JPA custom native query with index parameters

Lecture 23 Unit test Spring Data JPA custom Native query with Named parameters

Lecture 24 Refactoring JUnit tests to use @BeforeEach annotation

Lecture 25 Download source code of this section

Section 4: Spring Boot – Unit Testing Service Layer

Lecture 26 Service Layer unit testing overview

Lecture 27 Create EmployeeService with saveEmployee method

Lecture 28 Quick Recap of Mockito basics (before writing JUnit tests to use Mock objects)

Lecture 29 Unit test for EmployeeService saveEmployee method

Lecture 30 Using @Mock and @InjectMocks annotations to mock the object

Lecture 31 Unit test for saveEmployee method which throws Exception

Lecture 32 Unit test for EmployeeService getAllEmployees method – Positive Scenario

Lecture 33 Unit test for EmployeeService getAllEmployees method – Negative Scenario

Lecture 34 Unit test for EmployeeService getEmployeeById method

Lecture 35 Unit test for EmployeeService updateEmployee method

Lecture 36 Unit test for EmployeeService deleteEmployee method

Lecture 37 Download source code of this section

Section 5: Spring Boot – Unit Test Controller Layer (Unit Test REST APIs)

Lecture 38 Controller Layer unit testing overview

Lecture 39 Overview of @WebMvcTest annotation

Lecture 40 @WebMvcTest VS @SpringBootTest

Lecture 41 Build createEmployee REST API

Lecture 42 Unit test createEmployee REST API

Lecture 43 Build GetAllEmployees REST API

Lecture 44 Unit test GetAllEmployees REST API

Lecture 45 Refactoring JUnit test to use static imports

Lecture 46 Build getEmployeeById REST API

Lecture 47 Unit test getEmployeeById REST API – Positive Scenario

Lecture 48 Unit test getEmployeeById REST API – Negative Scenario

Lecture 49 Build updateEmployee REST API

Lecture 50 Unit test updateEmployee REST API – Positive Scenario

Lecture 51 Unit test updateEmployee REST API – Negative Scenario

Lecture 52 Build deleteEmployee REST API

Lecture 53 Unit test deleteEmployee REST API

Lecture 54 Download source code of this section

Section 6: Spring Boot – Integration Testing using Local MySQL Database

Lecture 55 Integration testing overview

Lecture 56 @SpringBootTest annotation overview

Lecture 57 Configure MySQL database for integration testing

Lecture 58 Create a base for Integration testing

Lecture 59 Integration test for create employee REST API

Lecture 60 Integration test for get all employees REST API

Lecture 61 Integration test for get employee by id REST API – Positive & Negative Scenarios

Lecture 62 Integration test for update employee REST API – Positive & Negative Scenarios

Lecture 63 Integration test for delete employee REST API

Lecture 64 Integration testing EmployeeRepository using MySQL database

Lecture 65 Download source code of this section

Section 7: Spring Boot – Integration Testing using Testcontainers

Lecture 66 What problem does Testcontainers solve

Lecture 67 Testcontainers overview

Lecture 68 Adding Testcontainers

Lecture 69 Integration Testing EmployeeController using Testcontainers

Lecture 70 Using @DynamicPropertySource

Lecture 71 Singleton containers pattern

Lecture 72 Integration Testing EmployeeRepository using Testcontainers

Lecture 73 Download source code of this section

Section 8: Quiz – Test Yourself

Section 9: Assignments and Solutions

Lecture 74 Assignments for You

Lecture 75 Solution for All the Assignments in One Video

Section 10: What’s Next?

Lecture 76 Discounts for My Other Udemy Courses

Lecture 77 Thank You Note and Feedback About This Course

This is course is for beginners as well as professional to teach how to write Unit and Integration tests for Spring boot application.

Course Information:

Udemy | English | 8h 28m | 5.42 GB
Created by: Ramesh Fadatare (Java Guides)

You Can See More Courses in the Developer >> Greetings from CourseDown.com

New Courses

Scroll to Top