Unit Testing in Java and Spring
Unit testing is a software development practice used to safe guard our expectation from the behavior of our code. Unit testing is done by developers and is a standard part of the development process.
In this course we are going to have a detailed look at how to write unit and integration tests for a Java and Spring application, starting from the most basic examples and reaching the most complex integration test cases possible within a Spring application. In order to better understand the practical value of unit and integration tests we will use a fully functional Spring project, for which we will take each comprising part and do full unit test coverage making sure we cover all relevant test cases. While writing our unit tests we will also get into specific details on how to establish, create and manage our tests data in order to adhere to Java development principles and practices, which ensure highest level of re-usability and flexibility for our tests.
Understand how to design and implement unit tests.
Correctly design, implement and manage test cases.
Correctly design, create and manage test data.
Design and implement integration tests in order to safeguard MVC and REST endpoints.
Design and implement integration tests in order to safeguard JPA repositories.
Intro
What are Unit Tests?
Levels of Testing
Testing Practices
Anatomy of a Unit Test
Unit Testing Quiz
Unit Testing Key Takeaways
Sample Project
Project Setup
JUnit 5 Overview
Only-once Setup and Tear-Down
Assertions and Assumptions
Testing Behavior, not Correctness
JUnit Quiz
JUnit Key Takeaways
Execution Branching
Boundary Value Analysis
Test Data Management
Test Data Management Quiz
Test Data Management Key Takeaways
Unit Isolation
Mockito
Matchers
BDD with AspectJ
Mockito Quiz
Mockito Key Takeaways
Integration Testing
Database Integration Testing
Database Constraints
MVC/REST API Integration Testing
Integration Testing Quiz
Integration Testing Key Takeaways