Azure / mec-app-solution-accelerator

Application Solution Accelerator for Multi-access Edge Compute (MEC)
MIT License
40 stars 11 forks source link

[Pending Feature - P2] Unit Tests and Functional Tests #28

Closed CESARDELATORRE closed 8 months ago

CESARDELATORRE commented 1 year ago

PRIORITY 2. Ideally, we need to have a couple of examples of each of the following by the major Preview Release, by late February. But this is not a priority compared to other peding areas such as performance tests, scalability tests and pending UI funcionality (show frame with bound-box, etc.).

Types of tests: SINGLE UNIT TEST Probably for the Rules Engine business rules. Example: https://learn.microsoft.com/en-us/dotnet/architecture/microservices/multi-container-microservice-net-applications/test-aspnet-core-services-web-apps#implementing-unit-tests-for-aspnet-core-web-apis

SINGLE FUNCTIONAL TEST FOR A SINGLE SERVICE Also, fo the Rules Engine, but this time testing the whole service through HTTP, by using the test web host (TestServer) is available in a NuGet component as Microsoft.AspNetCore.TestHost. It can be added to integration test projects and used to host ASP.NET Core applications. (Or any other similar approach, without using Docker/containers)

EXAMPLE: https://learn.microsoft.com/en-us/dotnet/architecture/microservices/multi-container-microservice-net-applications/test-aspnet-core-services-web-apps#implementing-integration-and-functional-tests-for-each-microservice

END-TO-END FUNCTIONAL TEST OF THE WHOLE SOLUTION WITH CONTAINERS: In this case, testing everything end to end, including video splitting (from a filepath video, so it's more reproducible, not a RTSP url from VM), and all the way through the multiple microservices until Alerts are generated.

Basically, you'll need to do a "docker compose up like this: docker-compose -f docker-compose-test.yml -f docker-compose-test.override.yml up

Basically, that "docker compose up" will only start the infrastructure services such as Mosquito and MongoDB. The services should be started by Visual Studio when running the tests using VS.

Microservice and Application functional/integration tests are run from Visual Studio, using the regular tests runner, but first you need to start the required infrastructure services (Mosquito, etc.), as mentioned.

EXAMPLE: https://learn.microsoft.com/en-us/dotnet/architecture/microservices/multi-container-microservice-net-applications/test-aspnet-core-services-web-apps#implementing-integration-and-functional-tests-for-each-microservice

dsaezvil commented 1 year ago

Ready Unit tests, on this commit 5cb17b403917a4c8176fec400f6fa8d9656f987a

CESARDELATORRE commented 1 year ago

Keep this issue open since we have very few Unit Tests, yet..