-
Notifications
You must be signed in to change notification settings - Fork 1
V. Testing
Read all about testing. Learn how to run tests and what kind of tests are available.
- Unit test per microservice
- Integration tests
- End-to-end tests or integration tests across the microservices
Within each service folder/solution is a test project usually called <service-name>.Test
. This project contains unit tests for the service. The tests are written using xUnit and Moq.
The tests can be executed from the IDE used or from the command line. To run the tests from the command line, navigate to the test project folder and run dotnet test
.
To run the tests from the IDE access the TestExplorer of your IDE and run the tests (Visual Studio instructions, or Rider instructions)
Integration tests are located in the IntegrationTests
folder. The tests are written using xUnit and Moq. The tests are using a test server and a test database. The test server is configured to use the test database. The test database is created and seeded with test data before the tests are running. After the tests have run the test database is deleted.
Currently the integration tests are a bit messy to run. Setting them up does only work partly automatically. The database migrations have to executed manually before the tests can be executed. Therefore the integration tests need some more work to be useful.
There is currently no such thing. But it would be a good idea to have some end-to-end tests. It would cover the communication and interaction between all services. For instance one service is raising an event and another service is listening to that event and reacts to it. This is currently not covered, but tests like this could help with that.