Unit, Integration and Mutation Testing Project

Steps for this exercice

1. Execute and test the app

  • a. Run the App:

First install runtime dependencies and development too:

dotnet restore

dotnet build

cd src/CoursesApp

dotnet run

  • b. See the results with Postman, access localhost:5011/courses with GET, and create a Course with POST, with something as:

    { "name": "Course 3" }

2. Run the Unit and Integration Tests with coverage

  • a. Run the tests:

cd ..

dotnet test --collect:"XPlat Code Coverage"

-b. See the Coverage, first Unit and second Integration:

reportgenerator -reports:"/home/dchavez/code/dotnet/CoursesAppGPT/CoursesApi.UnitTests/TestResults/d6f6d618-38fc-4edd-93e5-e966f1a7eb77/coverage.cobertura.xml" -targetdir:"coveragereport" -reporttypes:Html

See this file

coveragereport/index.html

reportgenerator -reports:"/home/dchavez/code/dotnet/CoursesAppGPT/CoursesApi.IntegrationTests/TestResults/181232b5-776b-413c-8db6-5f6f394c7a2a/coverage.cobertura.xml" -targetdir:"coveragereport" -reporttypes:Html

See this file

coveragereport/index.html

3. Execute Mutation Tests

  • a. Execute mutation tests:

dotnet stryker

  • b. Result of the Mutation:

/home/dchavez/code/dotnet/CoursesAppGPT/StrykerOutput/2024-06-20.15-00-00/reports/mutation-report.html

4. CQRS Option

  • a. Go to that branch:

git clone -b cqrs-architecture --single-branch https://github.com/diegochavezcarro/CoursesAppGPT.git CoursesAppCQRS

  • b. The same steps as before