Service testing in the Micronaut framework
Service testing is the next level to unit testing. By testing all the endpoints in a microservice and repeating this process for all the other microservices, we can make sure that all the services are working as expected edge to edge. It raises the quality check to the next level. Having said that, as we discussed before, as we move up in the test pyramid, test cases become more brittle, expensive, and sluggish, therefore, we need to establish a fine balance of not testing too much on the higher levels.
To learn how we can perform service testing in the Micronaut framework, we will continue with the pet-clinic microservice. In the following sections, we will go into testing all the REST endpoints of a service. We will use the @Order
annotation to establish the order of execution of a test in the suite. An ordered test suite can help in starting from scratch and cleaning up at the end. In the following examples, we will create, get, update...