View on GitHub

'Easy-peasy' Coveralls / .NET CORE integration with minicover

I recently set up Travis CI integration for YAGP YAGP. This included both the build and NUnit testing for the SharpGedParser project.

Next I wanted test coverage results integration with Coveralls - namely to show as a badge on Github. With some fumbling and dead-end research, I did get this working with Minicover.

At some point, minicover shipped coveralls reporting and this fact doesn't seem to have percolated to the rest of the web yet.

The end result is pretty simple and I hoped you might avoid some wasted research if I wrote it up here.

  1. The first step is get your build working with Travis and sign up with Coveralls.
  2. Read the minicover README and a blog entry at Automation Rhapsody. These were a big step forward for me getting this to work.
  3. Create a minicover project in your solution. This project has no code, only a reference to minicover. This is the recommended approach and allows 'dotnet restore' to fetch minicover automagically. See the blog above.
  4. In your travis.yml, use minicover to instrument the dll(s) under test, and point minicover at the pertinent sources. I have also excluded the test sources to remove them from the coverage stats.

    Note the current directory structure is as follows:


    Here is the relevant YML for YAGP:

        # Build the solution!
        - dotnet build
        # Minicover project below current working directory
        - cd minicover
        # my tests are currently merged in with the code; you
        # might have a separate test assembly. Note the 
        # exclusion of the test sources from coverage.
        - dotnet minicover instrument --workdir ../ --assemblies 
          TravisParse/**/bin/**/TravisParse.dll --sources 
          SharpGedParse/SharpGedParser/**/*.cs --exclude-sources 
        - dotnet minicover reset
        - cd ..
        # Run the tests!
        - dotnet test --no-build ./TravisParse/TravisParse.csproj

  5. Use minicover to report results to Coveralls!

    Here is the relevant YML for YAGP:

        # Run the tests!
        - dotnet test --no-build ./TravisParse/TravisParse.csproj
        - cd minicover
        # report coverage results to Coveralls!
        - dotnet minicover coverallsreport --root-path ../ --workdir 
    ../ --service-name "travis-ci" --service-job-id "$TRAVIS_JOB_ID"