![]() Next, add in the totally under appreciated. You might be able to get it to work but it's easier to keep things separate. NOTE: If you're doing code coverage you'll want to ensure your tests and tested assembly are NOT the same file. I can run "WatchTests.cmd" in another terminal, or within the VS Code integrated terminal. \my.tests test /p:CollectCoverage=true /p:CoverletOutputFormat=lcov /p:CoverletOutput=./ You can take it even further if you add "dotnet watch test" which will compile and re-run tests if code changes: dotnet watch -project. The files then watched by the VSCode Coverage Gutters extension and updates as the file changes if you click watch in the VS Code Status Bar. dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=lcov /p:CoverletOutput=./. I should be able to pick the coverage file manually with the extension, but due to a small bug, it's easier to just tell Coverlet to generate a specific file name in a specific format. SF:C:\github\hanselminutes-core\re\MarkdownTagHelper.cs SF:C:\github\hanselminutes-core\re\Constants.cs Those lcov files look like this, showing file names, file numbers, coverage, and number of exceptions. There is a language agnostic VS Code Extension called Coverage Gutters that can read in lcov files and others and highlight line gutters with red, yellow, green to show test coverage. You can then generate detailed reports from this. We're close with this setup, although it's a little slow.Ĭoverlet can produce opencover, lcov, or json files as a resulting output file. That means I want to have my tests open, my code open, and as I'm typing I want the solution to build, run tests, and update code coverage automatically the way Visual Studio proper does auto-testing, but in a more Rube Goldbergian way. I'm interested in "The Developer's Inner Loop.". ![]() (I think this should command line switch should be more like -coverage" but there may be an MSBuild limitation here.).Added coverlet, which integrates with MSBuild and automatically runs when you "dotnet test" if you "dotnet test /p:CollectCoverage=true".That means we can just "dotnet test" and it'll build and run tests.Our test project is using xunit and the xunit runner that integrates with.There's a lot going on here but take a moment and absorb the screenshot of VS Code above. ![]() ![]() NET Core Test Explorer - Discovers tests and gives you a nice explorer.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |