Skip to content

Latest commit

 

History

History
89 lines (54 loc) · 3.21 KB

TESTING.md

File metadata and controls

89 lines (54 loc) · 3.21 KB

Backend Testing Strategy

Unit Tests

Unit tests are executed automatically during the GitHub workflow pull-request_backend.yml sonar-scan-backend.yml

Test Reports

https://sonarcloud.io/project/issues?resolved=false&id=eclipse-tractusx_traceability-foss-backend sonar-scan-backend.yml

Test Coverage

Testing Frameworks and Libraries

Integration Tests

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.

Smoke Tests

n.a.

Regression Tests

Cucumber for regression testing.

Cucumber Tests

  • 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.

Load Tests

n.a.

Running tests

Unit tests

To run unit tests invoke following command:

mvn clean test

Integration tests

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

Running all tests

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.