O'Reilly logo

Learning Spring Boot by Greg L. Turnquist

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Testing with Spring Boot's CLI

So far, we've seen a tiny app power up using the popular Spring and Apache Tomcat web stack with little effort from our end. Spring Boot was able to detect that we wanted a Spring MVC app, and it put together the components we needed. However, in this day and age, no application is complete without coding some tests. Let's dig in a little more and see how to write some automated tests.

The spring test command kicks off Spring Boot; however, instead of magically adding a static void main method to run our app, it auto-configures test runners based on the code we supply. Let's first look at this example of a domain class and its related test case found inside Spring Boot's collection of test cases:

class Book { String ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required