Summary
We began this chapter with the testing pyramid and striking a fine balance in test automation with unit testing, service testing, and integration testing. We jumpstarted with some basics of unit testing, such as leveraging mocks and spies to write unit tests. We then dived into how we can write service tests to test various RESTful endpoints using a reactive HTTP client in the Micronaut framework. Finally, we explored the exciting world of test containers for integration testing. We wrote integration tests using Testcontainer
to instantiate MongoDB in the test environment.
This chapter provides you with a firm understanding of testing at various levels, such as unit, service, or integration in the Micronaut framework. After subtle yet nimble theoretical discussions, we followed up with good hands-on examples to enhance your practical skillset in automated testing in the Micronaut framework.
In the next chapter, we will explore how we can handle microservice architecture...