In this post, we will look at 3 libraries/tools for testing the end-points of web services.
Application repository
The application is a card game RESTapi, built with: Spring-boot, kotlin, Netflix tech stack (Zuul, Ribbon, Eureka), and a micro-services architecture. The project is exam delivery for subject PG6100-1 Java enterprise-2 at Westerdals.
Library for testing and validation of REST APIs.
In the current project, RestAssured is used in each module to perform HTTP calls and validate responses.
Create a new player.
Setup RestAssured configuration.
no.ern.game.player.controller.TestBase.kt
Test example.
no.ern.game.player.controller.PlayerControllerTest.kt
WireMock is an HTTP mock server. Provide an opportunity to test services in isolation.
This library allows triggering outbound requests, mock target service, and stub responses. Wiremock provides a range of opportunities to test microservices in isolation from each other.
Set up wiremock test base.
no.ern.game.player.controller.WiremockTestBase.kt
Kotlin did not support static
when the application was developed (maybe it has been changed already), so we used a companion object instead.
Test example.
In two words: tests in docker containers. Test containers offer opportunities to test -integration, -application layers, and UI tests(i.e., with selenium).
We use this library for end-to-end tests, validation, and checking of the most important components in the application. Application deployed in docker-compose environment, using local docker-compose and generic containers.
no.ern.game.e2etests.AuthFeatureIT
Test example.
no.ern.game.e2etests.AuthFeatureIT
Java library for sync async operations. It is a very convenient tool for writeing automated tests in an async environment.
We use it at:
That was a short overview of testing tools for web-services and applications with microservice architecture. RestAssured and WireMock libraries are well-known among Java developers. Testcontainers are something "new" (5 years history) to automate settings of containers environment. TestContainers run containers for automated tests and destroy them right after. Testcontainers library decreases integrated test complexity. And 'YES,' you do not need to install any more Oracle databases to run tests.