Skip to content

uk-gov-mirror/hmcts.vh-notification-api

 
 

Repository files navigation

vh-notification-api

Build Status

NotificationApi.Client package in vh-packages feed in Azure Artifacts

Quality Gate Status

Setup nuget sources

Include the vh-packages source

https://pkgs.dev.azure.com/hmctsreform/VirtualHearings/_packaging/vh-packages/nuget/v3/index.json

Include the govuk notify source

https://api.bintray.com/nuget/gov-uk-notify/nuget

Setup templates locally

Execute the environment template scripts to setup your local against it's respective notify environment

Running code coverage

First ensure you are running a terminal in the Notification Api directory of this repository and then run the following commands.

dotnet test --no-build NotificationApi.UnitTests/NotificationApi.UnitTests.csproj /p:CollectCoverage=true /p:CoverletOutputFormat="\"opencover,cobertura,json,lcov\"" /p:CoverletOutput=../Artifacts/Coverage/ /p:MergeWith='../Artifacts/Coverage/coverage.json' /p:Exclude="\"[*]NotificationApi.API.Extensions.*,[NotificationApi]NotificationApi.Startup,[NotificationApi]NotificationApi.Program,[*]NotificationApi.Swagger.*,[NotificationApi.*Tests?]*,[*]NotificationApi.DAL.Migrations.*,[*]NotificationApi.DAL.Mappings.*,[*]NotificationApi.Domain.Ddd.*,[*]NotificationApi.Domain.Validations.*,[NotificationApi.DAL]NotificationApi.DAL.NotificationApiDbContext,[NotificationApi.DAL]NotificationApi.DAL.DesignTimeHearingsContextFactory,[*]NotificationApi.Common.*,[*]Testing.Common.*"

dotnet test --no-build NotificationApi.IntegrationTests/NotificationApi.IntegrationTests.csproj /p:CollectCoverage=true /p:CoverletOutputFormat="\"opencover,cobertura,json,lcov\"" /p:CoverletOutput=../Artifacts/Coverage/ /p:MergeWith='../Artifacts/Coverage/coverage.json' /p:Exclude="\"[*]NotificationApi.API.Extensions.*,[NotificationApi]NotificationApi.Startup,[NotificationApi]NotificationApi.Program,[*]NotificationApi.Swagger.*,[NotificationApi.*Tests?]*,[*]NotificationApi.DAL.Migrations.*,[*]NotificationApi.DAL.Mappings.*,[*]NotificationApi.Domain.Ddd.*,[*]NotificationApi.Domain.Validations.*,[NotificationApi.DAL]NotificationApi.DAL.NotificationApiDbContext,[NotificationApi.DAL]NotificationApi.DAL.DesignTimeHearingsContextFactory,[*]NotificationApi.Common.*,[*]Testing.Common.*"

Generate HTML Report

Under the unit test project directory

dotnet reportgenerator "-reports:../Artifacts/Coverage/coverage.opencover.xml" "-targetDir:../Artifacts/Coverage/Report" -reporttypes:HtmlInline_AzurePipelines

Branch name

git hook will run on pre commit and control the standard for new branch name.

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

Commit message

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.

Run Zap scan locally

To run Zap scan locally update the following settings and run acceptance\integration tests

User Secrets:

  • "Services:NotificationApiUrl": "https://NotificationApi_AC/"

Update following configuration under appsettings.json under NotificationApi.AcceptanceTests or NotificationApi.IntegrationTests

  • "Services:NotificationApiUrl": "https://NotificationApi_AC/"
  • "ZapConfiguration:ZapScan": true
  • "ConnectionStrings:VhNotificationApi": "Server=localhost,1433;Database=VhNotificationApi;User=sa;Password=VeryStrongPassword!;" (IntegrationTest alone)

Note: Ensure you have Docker desktop engine installed and setup

Run Stryker

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

Global

dotnet tool install -g dotnet-stryker

Local

dotnet tool install dotnet-stryker

To update latest version of stryker please use the following command

dotnet tool update --global dotnet-stryker

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 93.0%
  • Gherkin 5.2%
  • Shell 1.1%
  • Other 0.7%