Chapter 6. Leaving Nothing to Luck – Unit Tests and Acceptance Tests

In this chapter, we will see why and how our application should be tested. We will see the differences between unit tests and acceptance tests, and learn how to do both.

This chapter is divided in two parts. In the first part, we will write tests in Java while studying the different ways of testing. In the second part, which is shorter, we will write the exact same tests in Groovy, and see how we can improve our code readability with this awesome language.

If you do everything in this chapter, you will have double tests, so feel free to keep only the tests that are most readable for you.

Why should I test my code?

Working in the Java world has made a lot of developers aware of the ...

Get Spring MVC: Designing Real-World Web Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.