Unit tests are executed automatically during the GitHub workflow pull-request_backend.yml sonar-scan-backend.yml
https://sonarcloud.io/project/issues?resolved=false&id=eclipse-tractusx_traceability-foss-backend sonar-scan-backend.yml
-
For more information on coverage see Architecture Documentation - Development concepts.
- The Trace-X project uses JUnit5 with AssertJ and Mockito and the testing capabilities of the Spring Boot Framework for unit testing.
Besides the Spring Boot features testing features the following frameworks and tools are used for integation testing:
- Testcontainers for bootstrapping integration tests with real services wrapped in Docker containers
- Wiremock for building mock APIs in order to simulate dependencies
The Wiremock tests are intended to cover the Trace-X flow and communication
without the need of a running environment that includes all dependencies.
Wiremock Tests and their corresponding utilities are marked by the suffix WiremockTest
respectively WiremockSupport
.
- Furthermore, the following libraries are utilized:
- Awaitility for expressing expectations of asynchronous code in a concise and easy to read manner.
- DataFaker for creating fake data.
n.a.
Cucumber for regression testing.
- There are Cucumber that verify the response bodies in more detail.
- See the module
tx-cucumber-tests
and the Cucumber Tests README for more information.
n.a.
To run unit tests invoke following command:
mvn clean test
Product Traceability FOSS Backend relies on Testcontainers library in order to provide persistence layer, thus Docker Engine is required to be running.
To run integration tests via command line, invoke following command:
mvn -pl tx-models,tx-backend,tx-coverage -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B verify
To run all tests invoke following command:
mvn -DskipTests=false clean verify
Please note that this task depends on integrationTest
task, so it's required to have Docker Engine running.