The first way I'll show to generate code coverage metrics is to add Coverlet to your test project. If you'd like to, read more about Coverlet on the project's GitHub Using Coverlet with Your. ![]() I'll show you how to use it both ways in this post. ![]() It can be used both as a Global Tool, or installed into a. NET, with support for line, branch and method coverage. I mentioned Coverlet at the start of this article, you're probably wondering what it is? Coverlet is a code coverage framework for. You don't have to use Xunit for this, but it's the testing framework I like, and it isn't always as well documented for this kind of thing so it is the tool I'm using. For this post I'll assume you're already familiar with unit testing and XUnit, if you're not read up on that first and come back to this post when you're ready to find some test coverage metrics. It still helps to write your code in a manner that is conducive to testing - think dependency injection, loose coupling, etc. NET Core code is no different than unit testing your. Interested? Read on and I'll explain how and provide link a sample project at the end of this post. ![]() With the introduction of Coverlet you can now generate code coverage metrics on the command line, and the further process the collected data into reports using Report Generator. NET Core projects had required using Visual Studio or a 3rd party paid tool. Until recently getting code coverage metrics for your. NET Core on the command line (CLI) and Visual Studio Code.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |