Skip to content

A Dapper-based .NET Core project for our favorite fictional brewery, Dappery.

Notifications You must be signed in to change notification settings

AjayKMehta/Dappery

 
 

Repository files navigation

CodeQL Infer#

Run tests codecov

Semgrep

Open in Visual Studio Code

Run unit tests

coverlet

dotnet test --collect:"XPlat Code Coverage" /p:CoverletOutputFormat=cobertura

Microsoft.CodeCoverage

Running dotnet test --collect "Code Coverage" at the solution level now automatically merges code coverage for all your test projects. See here for more information.

# These 2 commands do the same thing:
dotnet test --no-build --collect "Code Coverage;Format=cobertura"
dotnet-coverage collect -f cobertura -o report.cobertura.xml "dotnet test --no-build"

Instead of passing parameters to CLI command, you can use a .runsettings file instead:

dotnet test -s local.runsettings 

💡 local.runsettings is for running tests locally while cicd.runsettings is for running tests using GitHub workflows.

Display code coverage in VS Code:

Warning

💡 This currently only works with coverlet. Attempting to use Microsoft.CodeCoverage will silently fail.

  1. Install Coverage Gutters if not already installed.

  2. Make sure the setting coverage-gutters.coverageFileNames in settings.json includes "coverage.cobertura.xml" as shown below:

    "coverage-gutters.coverageFileNames": [
        "lcov.info",
        "cov.xml",
        "coverage.xml",
        "jacoco.xml",
        "coverage.cobertura.xml"
    ]
  3. From Command Palette, select Coverage Gutters: Display Coverage after you have run unit tests (see previous section).

Package restore

When building for CI/CD, we want to keep package versions locked based on lock file(s). If you encounter NU1403, try doing the following (source):

dotnet nuget locals all --clear
git clean -xfd
git rm **/packages.lock.json -f
dotnet restore

About

A Dapper-based .NET Core project for our favorite fictional brewery, Dappery.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 99.0%
  • TSQL 1.0%