From the course: Complete Guide To Java Testing with JUnit 5 & Mockito
Unlock the full course today
Join today to access over 24,900 courses taught by industry experts.
Write your first Spring Boot test
From the course: Complete Guide To Java Testing with JUnit 5 & Mockito
Write your first Spring Boot test
- [Instructor] Let's set up the testing environment for our Spring Boot application. We'll continue working on the application we used in the previous video with our Hello Controller. The first step is to set up the necessary dependencies for testing. In this case, we'll add Spring Boot Starter Test. (instructor typing) This includes various libraries and dependencies that are commonly used for testing purposes, making it easier to write and execute tests across different layers of your application. Some of these include JUnit, Mockito, as well as Spring Boot Test and Spring Test. The latter two provide integration testing support, which we'll cover later in this chapter. Now let's write our first Spring Boot Test. We'll create a new test called Hello Controller Test. Then we'll annotate this class with Web MVC Test, passing in our Hello Controller class. This annotation is designed only to test the web layer or controller layer of your application. This means you can focus on testing…
Contents
-
-
-
-
-
-
-
-
-
-
(Locked)
Walk through a basic Spring Boot application3m 53s
-
(Locked)
Write your first Spring Boot test3m 43s
-
(Locked)
Test Spring data repositories6m 1s
-
(Locked)
Test Spring services4m 9s
-
(Locked)
Test Spring controllers5m 58s
-
(Locked)
Integration testing with Spring Boot10m 40s
-
(Locked)
Best practices and tips for testing Spring Applications2m 9s
-
(Locked)
Challenge: Test a Spring weather application1m 8s
-
(Locked)
Solution: Test a Spring weather application16m 37s
-
(Locked)
-