Coder Social home page Coder Social logo

barisates / dotnet-core-gitlab-ci-cd-settings Goto Github PK

View Code? Open in Web Editor NEW
12.0 1.0 1.0 2 KB

GitLab CI / CD settings for displaying test coverage report output in ASP.NET Core applications.

dotnet-core gitlab-ci gitlab-runner coverage-report unit-test

dotnet-core-gitlab-ci-cd-settings's Introduction

dotnet-core-gitlab-ci-cd-settings

GitLab CI / CD settings for displaying test coverage report output in ASP.NET Core applications.

Coverlet

We use Coverlet for code coverage report. It allows us to integrate GitLab CI / CD by displaying the report output on the console. For detailed knowledgeable; Coverlet.

Coverlet should only be added to your test projects!

Latest stable version: NuGet

MSBuild Integration:

dotnet add package coverlet.msbuild

Coverlet output on Gitlab CI / CD:

Coverlet output on Gitlab CI / CD

GitLab CI / CD

To manage the GitLab CI / CD process, we need knowledge of the project's code coverage report about testing. After adding the Coverlet package to our test project, we make GitLab CI / CD settings.

Test stage script for .gitlab-ci.yml file:

test:
  stage: test
  script:
    - dotnet test /p:CollectCoverage=true

Test coverage parsing:

Total[^|]*\|[^|]*\s+([\d\.]+)

Coverage report badge:

Coverage report badge

dotnet-core-gitlab-ci-cd-settings's People

Contributors

barisates avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

logo2k

dotnet-core-gitlab-ci-cd-settings's Issues

MSBuild interpreting /p flag incorrectly

Hi,

Seem to be having an issue that nobody else on the internet has encountered...

$ dotnet test /p:CollectCoverage=true
MSBUILD : error MSB1009: Project file does not exist.
Switch: p:CollectCoverage=true

This happens from within the solution and within the test project. Specifying either csproj gives the same error:

$ dotnet test /p:CollectCoverage=true MyProject/MyProject.csproj
MSBUILD : error MSB1008: Only one project can be specified.
Switch: Sunrise/Sunrise.csproj

For switch syntax, type "MSBuild -help"

And same when specifying the test project file.

I think I'm missing something simple but I'm absolutely stumped, running just dotnet test has no issues.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.