Since the endpoint-auth-service consists of multiple components working together, a dedicated integration-test suite is used. In order to provide readability, cucumber with the gherkin-syntax was choosen. The test-files can be found here:
- gherkin-files The actual test-implementation is done with junit-5 and the okHttp-Library.
Precondition: The tests require docker-compose and maven to be installed. See https://maven.apache.org/install.html and https://docs.docker.com/compose/install/ for instructions
The tests expect an already running system, configured according to the provided docker-compose. Please read the documentation of the compose-setup before starting. The tests make use of echo-servers as endpoints to mock the actual request-endpoints and to inspect the request. The code for the echo-server is here: echo-server.
To execute the test, run mvn clean verify
. The test will check if an endpoint-configuration-service is running in the background-step. Test-results will be printed out on the commandline aned
can be found after the test under /target/surefire-reports/
.
Every change should be tested via unit-test. Integration-tests are close to the top of the testing-pyramid and therefor hard to write and expensive to run. However, if a new feature, especially one the includes multiple components, is added, an integration-test should be created.
- add a cucumber.feature under integration-test/src/test/resources/it - detailed and expressive wording is very welcome
- try to reuse existing steps as much as possible(see StepDefinitions), increases readability and decreases maintenance
- implement the additional steps(e.g. Given, When, Then) if needed (see StepDefinitions)
Execution in the test-pipeline will happen automatically.