第一次全英文写作
Install:
dotnet tool install --global coverlet.console
dotnet tool install -g dotnet-reportgenerator-globaltool
run test command under test project path
dotnet test --collect:"XPlat Code Coverage"
coyp the path of coverage.cobertura.xml from the result of previous command to create report
reportgenerator -reports:D:\proj\Suagr\SugarTests\TestResults\dd2d4442-b2d3-4869-b4d8-9d050dad94b8\coverage.cobertura.xml -targetdir:D:\Reports
You can install VS Extention:
Run Coverlet Report VS2022
to run these commonds automatically, and the extension can highlight code that is not covered in red
of course you can also turn off Highlighting by clicking on Tool |Toggle Code Coverage Highlighting