diff --git a/README.md b/README.md index 327ae797..4aa21daf 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,46 @@ Alternatively, the application can be started by using the provided Makefile: make start-all-heureka ``` +### Tests + +Heureka uses [Ginkgo](https://onsi.github.io/ginkgo/) for behavior-driven development (BDD) style tests. In the current project setup, tests are organized into three different directories, each serving a specific purpose: + +- End-to-End Tests: These tests are located in the ./internal/e2e directory. End-to-end tests are designed to test the flow of an application from start to finish and ensure all integrated pieces of an application function as expected together. + +- Application Layer Tests: These tests resides in the ./internal/app directory. Application layer tests focus on testing the application's behavior, such as handling requests and responses, executing appropriate logic, and more. + +- Database Tests: These tests are found in the ./internal/database/db directory. Database tests ensure that the application correctly interacts with the database. They test database queries, updates, deletions, and other related operations. + +If `LOCAL_TEST_DB` is set to `true` in `.test.env`, the tests will interact with a local database; otherwise, they will run against a containerized database. + +Run all tests: +``` +ginkgo -r +``` + +Run end-to-end tests: +``` +ginkgo ./internal/e2e +``` + +Run application tests: +``` +ginkgo ./internal/app +``` + +Run database tests: +``` +ginkgo ./internal/database/mariadb +``` + +The ginkgo `-focus` allows using a regular expression to run a specific test: +``` +ginkgo -focus="Getting Services" ./internal/database/mariadb +``` +If the test block you're trying to run depends on `BeforeEach`, `JustBeforeEach`, or `Describe` blocks that aren't being run when you use the `-focus` flag, this could cause the test to fail. + + + ## Support, Feedback, Contributing This project is open to feature requests/suggestions, bug reports etc. via [GitHub issues](https://github.com/SAP//issues). Contribution and feedback are encouraged and always welcome. For more information about how to contribute, the project structure, as well as additional contribution information, see our [Contribution Guidelines](CONTRIBUTING.md).