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

Coverlet console + vstest runs, but generates cobertura.xml is empty #752

Closed
ldcl289 opened this issue Mar 6, 2020 · 2 comments
Closed
Labels
as-designed Expected behaviour

Comments

@ldcl289
Copy link

ldcl289 commented Mar 6, 2020

Hi,

I'm working on a project that has a mix of c++ and c# projects, hosted on azure devops.
Both types with their own unit test, the C++ with gmock.
Since azure doesn't support vstest.console coverage result's, I'm looking for any workaround.
I have been trying coverlet to get the cobertura.xml that can be published into my pipelines.
But when I do it, it runs everything right, generates the .coverage as expected (I can open it in vs and navigate my hierarchy), but the cobertura.xml is empty:
<?xml version="1.0" encoding="utf-8"?> <coverage line-rate="1" branch-rate="1" version="1.9" timestamp="1583454090" lines-covered="0" lines-valid="0" branches-covered="0" branches-valid="0"> <sources /> <packages /> </coverage>

...and, after a sucessfull execution with the regular printing from vstest, I'm getting "NaN%" printed in the console:
`
Calculating coverage result...
Generating report 'C:\tpapps\src\prime\main\lib\TOS36\Debug\coverage.cobertura.xml'
+--------+------+--------+--------+
| Module | Line | Branch | Method |
+--------+------+--------+--------+

+---------+------+--------+--------+
| | Line | Branch | Method |
+---------+------+--------+--------+
| Total | 100% | 100% | 100% |
+---------+------+--------+--------+
| Average | NaN% | NaN% | NaN% |
+---------+------+--------+--------+
`

I've searched on the web, but the "closer" thing is a one that it's printing "∞%", not NaN. Either way, my binaries are already in Debug, not on Release.

This is the command line:
./coverlet.exe .\MyUnitTest.exe --target "$vstest" --targetargs "MyUnitTest.exe /InIsolation /Platform:x64 /TestAdapterPath:c:\local\packages\GoogleTestAdapter.0.17.1\build\_common /Enablecodecoverage /Settings:C:\local\cpp.runsettings" --verbosity detailed --include "[*DllFilter*]*" --format "cobertura"

@MarcoRossignoli MarcoRossignoli added the needs more info More details are needed label Mar 6, 2020
@MarcoRossignoli
Copy link
Collaborator

Hi @ldcl289,

coverlet can only cover .net core/.net framework app, so it doesn't work on c++ code.

Since azure doesn't support vstest.console coverage result's, I'm looking for any workaround.

At the moment is not supported for .net framework app microsoft/vstest#2278

@MarcoRossignoli MarcoRossignoli added as-designed Expected behaviour and removed needs more info More details are needed labels Mar 6, 2020
@ldcl289 ldcl289 closed this as completed Mar 6, 2020
@ldcl289
Copy link
Author

ldcl289 commented Mar 6, 2020

Thanks for your quick answer.
I will explore this when I have to enable the coverage for the c# projects.

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

No branches or pull requests

2 participants