Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No output generated #6

Closed
Structed opened this issue Mar 22, 2018 · 19 comments
Closed

No output generated #6

Structed opened this issue Mar 22, 2018 · 19 comments

Comments

@Structed
Copy link

I have installed the package to my test project, ran dotnet test /p:CollectCoverage=true as well as dotnet 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

@tonerdo
Copy link
Collaborator

tonerdo commented Mar 22, 2018

@Structed pls target netcoreapp2.0 and let me know if you still don't see an output

@SchneiderPatrick
Copy link

@tonerdo Hey :) I have the same problem targeting netcoreapp2.0.

@tonerdo
Copy link
Collaborator

tonerdo commented Mar 22, 2018

What's the output of dotnet --info?

@tonerdo
Copy link
Collaborator

tonerdo commented Mar 22, 2018

Also, what test framework are you using?

@SchneiderPatrick
Copy link

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

@tonerdo
Copy link
Collaborator

tonerdo commented Mar 23, 2018

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?

@lukasz-ciura
Copy link

lukasz-ciura commented Mar 23, 2018

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?

@mihasic
Copy link

mihasic commented Mar 23, 2018

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

@jeankedotcom
Copy link
Contributor

Hi, I am having the same problem as @lukasz-ciura-neyber

Using dotnet 2.1.203

error

file

@tonerdo
Copy link
Collaborator

tonerdo commented Mar 26, 2018

Try out the new NuGet package and let me know how it goes https://www.nuget.org/packages/coverlet.msbuild/1.0.1

@mihasic
Copy link

mihasic commented Mar 26, 2018

works for me, thank you

@jeankedotcom
Copy link
Contributor

With version 1.0.1 I get another error

coverlet-error

@tonerdo
Copy link
Collaborator

tonerdo commented Mar 26, 2018

@jeankedotcom I think that happens when calculating the summary result. The coverage results file should still have been generated

@jeankedotcom
Copy link
Contributor

@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?

@tonerdo
Copy link
Collaborator

tonerdo commented Mar 26, 2018

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?

@jeankedotcom
Copy link
Contributor

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);

@jeankedotcom
Copy link
Contributor

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

@tonerdo
Copy link
Collaborator

tonerdo commented Mar 26, 2018

@jeankedotcom I'm working with weekly release cycles. All fixes that make it in this week will be release come next Monday

@tonerdo
Copy link
Collaborator

tonerdo commented Apr 2, 2018

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants