Closed Structed closed 6 years ago
@Structed pls target netcoreapp2.0
and let me know if you still don't see an output
@tonerdo Hey :) I have the same problem targeting netcoreapp2.0.
What's the output of dotnet --info
?
Also, what test framework are you using?
I also tried the latest stable version of the .net core sdk. I used xunit and mstest. same result with both of these.
.NET Command Line Tools (2.1.300-preview1-008174)
Runtime Environment: OS Name: Windows OS Version: 10.0.16299 OS Platform: Windows RID: win10-x64
So my only thought is Coverlet is unable to find a suitable assembly to instrument. Couple of questions:
What's the structure of your solution? Are your tests in the same project with the classes you're testing? Does the assembly you're trying to get coverage for have a PDB?
Hi, I have similar problem, but I get error in output:
Calculating coverage result... C:\Users\username.nuget\packages\coverlet.msbuild\1.0.0\build\netstandard2.0\coverlet.msbuild.targets(19,5): error : Could not find file 'C:\Users\username\AppData\Local\Temp\ProjectName.Common_6c1a88f4-0f61-4510-827b-a26cc32ae3a4'. [C:\Users\username\Projects\ProjectName\ProjectName\src\Tests\ProjectName.GatewayCommon.UnitTests\ProjectName.GatewayCommon.UnitTests.csproj]
But file exists with extension .dll: C:\Users\username\AppData\Local\Temp\ProjectName.Common_6c1a88f4-0f61-4510-827b-a26cc32ae3a4.dll
@tonerdo, can you advice?
If you want to check on failing project: https://github.com/mihasic/LuceneSearch/tree/coverlet
In my case the file is being created, but, probably, at the later stage
Hi, I am having the same problem as @lukasz-ciura-neyber
Using dotnet 2.1.203
Try out the new NuGet package and let me know how it goes https://www.nuget.org/packages/coverlet.msbuild/1.0.1
works for me, thank you
With version 1.0.1 I get another error
@jeankedotcom I think that happens when calculating the summary result. The coverage results file should still have been generated
@tonerdo you are right, the coverage file exists.
But if the "dotnet test" command fails it will break my CI build on GitLab. Can I disable the summary report?
Hmmm... there's currently no way to disable summary, I should probably add that option. Is there a way for you to ignore that error?
I will check if I can ignore the error. Or maybe you could check for totalLines to be 0 in line 35 of CoverageSummary.cs.
Something like this?
result.Add(System.IO.Path.GetFileNameWithoutExtension(mod.Key), totalLines == 0 ? totalLines : (linesCovered * 100) / totalLines);
Thanks @tonerdo for accepting the pull request.
To whom it may concern, while awaiting the arrival of the next version of the nuget package I am ignoring the error return code of the "dotnet test" command on Linux in my GitLab CI by "or-ing" it with true.
So instead of using:
dotnet test --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover ./Tododeloo.Test/Tododeloo.Test.csproj
I am using:
(dotnet test --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover ./Tododeloo.Test/Tododeloo.Test.csproj) || true
@jeankedotcom I'm working with weekly release cycles. All fixes that make it in this week will be release come next Monday
@jeankedotcom new NuGet release which should completely fix this isse: https://www.nuget.org/packages/coverlet.msbuild/1.0.2. Feel free to reopen if any more errors show up
I have installed the package to my test project, ran
dotnet test /p:CollectCoverage=true
as well asdotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
, but no code coverage report was generated.dotnet SDK: 1.0.4 Taregt Framework: netcoreapp1.1 xunit: 2.3.1 coverlet.msbuild: 1.0.0