axodox / AxoCover

Nice and free .Net code coverage support for Visual Studio with OpenCover.
https://marketplace.visualstudio.com/items?itemName=axodox1.AxoCover
MIT License
248 stars 60 forks source link

Coverage report not generated #189

Open hristijankiko opened 5 years ago

hristijankiko commented 5 years ago

Hi,

I just installed OpenCover and AxoCover in VS2017 Professional and I can not get the Coverage report to generate. The tests all execute successfully, but the coverage report never gets generated.

This is the output in the console:

<< Executor finished.
| File redirection rules are cleared.
< Test execution finished.
Shutting down...
Exiting...
Generating coverage report...
Committing...
No results, this could be for a number of reasons. The most common reasons are:
    1) missing PDBs for the assemblies that match the filter please review the
    output file and refer to the Usage guide (Usage.rtf) about filters.
    2) the profiler may not be registered correctly, please refer to the Usage
    guide and the -register switch.
Test execution finished.

The coverage reports are empty:

<?xml version="1.0" encoding="utf-8"?>
<CoverageSession xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Version="4.6.0.0">
  <Summary numSequencePoints="0" visitedSequencePoints="0" numBranchPoints="0" visitedBranchPoints="0" sequenceCoverage="0" branchCoverage="0" maxCyclomaticComplexity="0" minCyclomaticComplexity="0" maxCrapScore="0" minCrapScore="0" visitedClasses="0" numClasses="0" visitedMethods="0" numMethods="0" />
  <Modules />
</CoverageSession>

Project is built as x86 Debug mode. Tests: image

Coverage report page: image

.settings file

{
  "TestRunner": "",
  "TestPlatform": "x86",
  "TestApartmentState": "STA",
  "TestAdapterMode": "Standard",
  "IsRedirectingFrameworkAssemblies": true,
  "TestSettings": "..\\AppOSTest\\default.runSettings",
  "ExcludeAttributes": "System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute",
  "ExcludeFiles": "",
  "ExcludeDirectories": "",
  "Filters": "+[*]*",
  "IsIncludingSolutionAssemblies": true,
  "IsExcludingTestAssemblies": false,
  "IsCoveringByTest": true,
  "IsMergingByHash": true,
  "IsSkippingAutoProps": true,
  "IsVisitorCountLimited": false,
  "VisitorCountLimit": 10
}

Is there something else I need to for this to work?

Edit: Added .settings file

Edit2: Successfully generated OpenCover report using the command line. I just need to specify -filter and -register. Where can I do this with AxoCover?

BrianTurner-RA commented 5 years ago

I have this exact same issue. Any ideas?

pjopaul commented 5 years ago

I had same issue and below solution from the owner worked for me

https://github.com/axodox/AxoCover/issues/172#issuecomment-406562661

Go to the directory where AxoCover is installed. You can locate this by running a long test (e.g. thread sleep, and open the file location of the AxoCover.Host-*.exe from the task manager. For example for me it is: C:\Users\axodo\AppData\Local\Microsoft\VisualStudio\15.0_6d93d79f\Extensions\pfu3q5ow.kny\ Then navigate to OpenCover\x86 or x64 depending on what platform your tests are running Open CMD with admin right Enter: regsvr32 /i OpenCover.Profiler.dll You will get a dialog that DLL is registered.

reverence89 commented 4 years ago

I had same issue and below solution from the owner worked for me

#172 (comment)

Go to the directory where AxoCover is installed. You can locate this by running a long test (e.g. thread sleep, and open the file location of the AxoCover.Host-*.exe from the task manager. For example for me it is: C:\Users\axodo\AppData\Local\Microsoft\VisualStudio\15.0_6d93d79f\Extensions\pfu3q5ow.kny Then navigate to OpenCover\x86 or x64 depending on what platform your tests are running Open CMD with admin right Enter: regsvr32 /i OpenCover.Profiler.dll You will get a dialog that DLL is registered.

Was having the same problem today for VS 2017 Professional and registering the DLL like this mentions fixed it for me.

jldmatwork commented 2 years ago

I have the same issue, and if apply the "registering dll solution" it works. But it works only if I don't change the configuration. If I change from Debug to Release or vice-versa then I have to register the DLL again. This is really odd.

Maybe it would be easier if I had the ability to pass the "-register" param to de opencover.console.exe when it is called.