Use OpenCover in .gitlab-ci.yaml

574 views Asked by At

I have install OpenCover and Report Generator nuget, but do not know how to trigger run OpenCover in .gitlab-ci.yaml to run testing for getting the code coverage.

1

There are 1 answers

0
Shaun Wilde On

OpenCover and ReportGenerator are command line tools as such you need to first make sure you can run them locally and you are able to review the results. Both tools have documentation on this that I recommend you should read first to make sure you are using the options that are right for you; OpenCover has a packaged sample project for you that you can use a guide.

Once you are happy with running the tool locally you are not ready to add it to your CI/CD environment.

As OpenCover is a Windows .NET profiler you need to make sure you use a windows image e.g. windows-latest. You can add your commands as steps; I find it easier to package commands into a single .bat file and then you only need to have one step to run OpenCover and then ReportGenerator.