question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

0% coverage is being shown after running tests

See original GitHub issue

Hi,

After running my tests with Nunit I get an unexpected result from coverlet. My folder structure is

root 
  \src 
     \projectfolder\project.csproj
  \tests
     \testprojectfolder\testproject.csproj
  \solution.sln

I executed the tests from within the testprojectfolder The result is printed below.

dotnet test /p:CollectCoverage=true
Build started, please wait...
Build completed.

Test run for /home/rob/git/svc_system_center/tests/Sag.SystemCenter.Api.Tests/bin/Debug/netcoreapp2.0/Sag.SystemCenter.Api.Tests.dll(.NETCoreApp,Version=v2.0)
Microsoft (R) Test Execution Command Line Tool Version 15.5.0
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
NUnit Adapter 3.9.0.0: Test execution started
Running all tests in /home/rob/git/svc_system_center/tests/Sag.SystemCenter.Api.Tests/bin/Debug/netcoreapp2.0/Sag.SystemCenter.Api.Tests.dll
NUnit3TestExecutor converted 456 of 456 NUnit test cases

NUnit Adapter 3.9.0.0: Test execution complete

Total tests: 456. Passed: 452. Failed: 0. Skipped: 4.
Test Run Successful.
Test execution time: 3.8804 Seconds

Calculating coverage result...
  Generating report '/home/rob/git/svc_system_center/tests/Sag.SystemCenter.Api.Tests/coverage.json'

+--------------------------------------------+--------+--------+--------+
| Module                                     | Line   | Branch | Method |
+--------------------------------------------+--------+--------+--------+
| Sag.SystemCenter.LoginManagement.BL        | 0%     | 0%     | 0%     |
+--------------------------------------------+--------+--------+--------+
| Sag.SystemCenter.UserManagement.BL         | 0%     | 0%     | 0%     |
+--------------------------------------------+--------+--------+--------+
| Sag.SystemCenter.Identity                  | 0%     | 0%     | 0%     |
+--------------------------------------------+--------+--------+--------+
| Sag.SystemCenter.UserManagement.DAL        | 0%     | 0%     | 0%     |
+--------------------------------------------+--------+--------+--------+
| Sag.SystemCenter.ApiManagement             | 0%     | 0%     | 0%     |
+--------------------------------------------+--------+--------+--------+
| Sag.SystemCenter.Captcha.BL                | 0%     | 0%     | 0%     |
+--------------------------------------------+--------+--------+--------+
| Sag.SystemCenter.Domain                    | 0%     | 0%     | 0%     |
+--------------------------------------------+--------+--------+--------+
| Sag.SystemCenter.Api                       | 0%     | 0%     | 0%     |
+--------------------------------------------+--------+--------+--------+
| Sag.SystemCenter.Messaging                 | 0%     | 0%     | 0%     |
+--------------------------------------------+--------+--------+--------+
| Sag.SystemCenter.ApplicationManagement.DAL | 0%     | 0%     | 0%     |
+--------------------------------------------+--------+--------+--------+

I’m running on a Linux Mint machine with this dotnet configuration

.NET Command Line Tools (2.1.4)

Product Information:
 Version:            2.1.4
 Commit SHA-1 hash:  5e8add2190

Runtime Environment:
 OS Name:     linuxmint
 OS Version:  18.3
 OS Platform: Linux
 RID:         linux-x64
 Base Path:   /usr/share/dotnet/sdk/2.1.4/

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.5
  Build    : 17373eb129b3b05aa18ece963f8795d65ef8ea54

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:103 (11 by maintainers)

github_iconTop GitHub Comments

5reactions
emonhaidercommented, May 8, 2019

FWIW I had the same or similar issue

Calculating coverage result...
/Users/bernhardrichter/.nuget/packages/coverlet.msbuild/2.6.0/build/netstandard2.0/coverlet.msbuild.targets(21,5): warning : [coverlet] Hits file:'/var/folders/6j/4hkjjhd50fg27s933nctz0480000gn/T/LightInject_ec1a3da6-cdb3-4ccb-91ab-89099645830a' not found for module: 'LightInject' [/Users/bernhardrichter/GitHub/LightInject/src/LightInject.Tests/LightInject.Tests.csproj]

Deleting the bin folder of the test project solved it. 😀

I can confirm this fixed the issue! Good find @seesharper!

4reactions
queen-of-codecommented, Sep 6, 2019

I can confirm that at least some of my issues were FIXED in this combo of releases. Thank you all for your effort here!

On Fri, Sep 6, 2019 at 6:48 AM Marco Rossignoli notifications@github.com wrote:

I have released vstest with this, but this will flow into dotnet sdk 2.2.4 only.

@vagisha-nidhi https://github.com/vagisha-nidhi can you confirm that last release of sdk 2.2.401(runtime 2.2.6) inject inproc data collector?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tonerdo/coverlet/issues/110?email_source=notifications&email_token=AEIOSMKLW6BJEFHIIXL2AG3QIJNSNA5CNFSM4FCAAE2KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6C4VJA#issuecomment-528861860, or mute the thread https://github.com/notifications/unsubscribe-auth/AEIOSMJYPTER34BZUKBBH5DQIJNSNANCNFSM4FCAAE2A .

Read more comments on GitHub >

github_iconTop Results From Across the Web

Overall code coverage showing zero after running test class
Every now and then I encounter the following issue after I run my test classes, they all marked as completed and pass, however...
Read more >
Why am I getting 0 coverage from Jest when running it ...
I've found the problem and a workaround for it. In my package.json I have my Jest configuration and it includes: "jest": { "rootDir":...
Read more >
Code Coverage is showing 0% for java projects - SonarQube
Hi, We have recently upgraded our sonar application from 7.1 to 7.9.6 (LTS in 7.x). We have observed that code coverage is showing...
Read more >
My all Test Case Is passed But still getting 0% coverage
Test Class methods are passing But but when i am checking the Code Coverage it is giving me 0% coverage & there is...
Read more >
Code coverage testing - Visual Studio (Windows)
To Show 0% covered, enter "Not Covered (%Lines)":"0" in the search box. Manage code coverage results. The Code Coverage Results window usually ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found