Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/280.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C#封面结果始终为空_C#_Unit Testing_.net Core_Coverlet - Fatal编程技术网

C#封面结果始终为空

C#封面结果始终为空,c#,unit-testing,.net-core,coverlet,C#,Unit Testing,.net Core,Coverlet,拥有.net core 3.1 Microsoft.net.sdk项目,以及大量异步xUnit测试 已尝试-将coverlet.msbuild 2.9.0添加到项目中,然后运行: dotnet测试公共\Common.csproj/p:CollectCoverage=true/ 100%显示,但创建了一个空覆盖率文件 已尝试-将coverlet.collector 1.3.0添加到项目中,然后运行: dotnet test Common\Common.csproj--收集:“XPlat代码覆盖率

拥有.net core 3.1 Microsoft.net.sdk项目,以及大量异步xUnit测试

  • 已尝试-将coverlet.msbuild 2.9.0添加到项目中,然后运行:
    dotnet测试公共\Common.csproj/p:CollectCoverage=true/
    100%显示,但创建了一个空覆盖率文件
  • 已尝试-将coverlet.collector 1.3.0添加到项目中,然后运行:
    dotnet test Common\Common.csproj--收集:“XPlat代码覆盖率”
    在testresults\{guid}\coverage.cobertura.xml中创建了一个文件,但它只是说covered=0

而stdout说88个测试在4s中运行。我做错了什么?

For me coverlet.msbuild可以完美地使用以下命令:
dotnet test Common\Common.csproj/p:CollectCoverage=true/p:IncludeTestAssembly=true/p:CoverletOutputFormat=cobertura/p:ExcludeByFile=\“**/Microsoft.NET.test.Sdk.Program.cs\”


所以,我猜您错过了这里的CoverletOutputFormat。

对于我来说,coverlet.msbuild与以下命令完美配合:
dotnet test Common\Common.csproj/p:CollectCoverage=true/p:IncludeTestAssembly=true/p:CoverletOutputFormat=cobertura/p:ExcludeByFile=\“**/Microsoft.NET.test.Sdk.Program.cs\”


所以,我想你错过了封面输出格式。

谢谢!这不是输出格式,但我缺少的是/p:IncludeTestAssembly=true。现在它工作得很好。谢谢!这不是输出格式,但我缺少的是/p:IncludeTestAssembly=true。现在它工作得很好。