The Test Api supports the acceptance tests in the vh-video-web, vh-service-web and vh-admin-web projects by centralising the management of test users and data, as well as providing a mechanism for the front end tests to retreive data from the backend vh-booking-api, vh-video-api and vh-user-api.
If the interface for the Bookings API Client, Video API Client or User API Client are missing after cloning the repo, these can be rebuilt using the following command:
In the TestApi.Services.Generator
folder:
nswag run
The branch name should start with: feature/VIH-XXXX-branchName (X - is digit). If git version is less than 2.9 the pre-commit file from the .githooks folder need copy to local .git/hooks folder. To change git hooks directory to directory under source control run (works only for git version 2.9 or greater) : $ git config core.hooksPath .githooks
The commit message will be validated by prepare-commit-msg hook. The commit message format should start with : 'feature/VIH-XXXX : ' folowing by 8 or more characters description of commit, otherwise the warning message will be presented.
To run stryker mutation test, go to UnitTest folder under command prompt and run the following command
dotnet stryker
From the results look for line(s) of code highlighted with Survived\No Coverage and fix them.
If in case you have not installed stryker previously, please use one of the following commands
dotnet tool install -g dotnet-stryker
dotnet tool install dotnet-stryker
To update latest version of stryker please use the following command
dotnet tool update --global dotnet-stryker
To run Zap scan locally update the following settings and run acceptance\integration tests
Update following configuration under appsettings.json under TestApi.IntegrationTests
- "Services:TestApiUrl": "https://TestApi_AC/"
- "ZapConfiguration:ZapScan": true
- "ConnectionStrings:TestApi": "Server=localhost,1433;Database=TestApi;User=sa;Password=VeryStrongPassword!;" (TestApi\appsettings.development.json)
Note: Ensure you have Docker desktop engine installed and setup