4

I am using OpenCover to get the coverage of the tests in my application .Net Core

When I run the OpenCover command, my tests are executed, but no classes are visited. Furthermore, my coverage is always 0.

Total de testes: 2. Aprovados: 2. Com falha: 0. Ignorados: 0.
Execução de Teste Bem-sucedida.
Tempo de execução de teste: 7,6713 Segundos
Committing...
Visited Classes 0 of 18 (0)
Visited Methods 0 of 68 (0)
Visited Points 0 of 133 (0)
Visited Branches 0 of 74 (0)

==== Alternative Results (includes all methods including those without corresponding source) ====
Alternative Visited Classes 0 of 19 (0)
Alternative Visited Methods 0 of 92 (0)

My OpenCover command is this one:

"%LOCALAPPDATA%\Apps\OpenCover\OpenCover.Console.exe" -oldstyle -output:"%CD%\opencover.xml" -register:user -target:"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" -targetargs:"InterpretadorFaleConoscoWexTests\bin\Debug\net461\InterpretadorFaleConoscoWexTests.dll"

I already put the tag <DebugType>Full</DebugType> , tried with and without TestAdapterPath and oldStyle and other tags, and no one worked. My coverage is always 0.

Can anyone give me any help?

I´ve seen some people with the same problem. However, there was no answer that solved my problem.

Thank you in advance.

Edit 1: I tried to use the -noshadow argument, but I get an error saying that this is not a valid argument. And the oficial documentation here does not show this argument. So maybe it was deprecated, I don't know

Artur Quirino
  • 486
  • 6
  • 21
  • 1
    Pls post here if you will find solution – Borys Fursov Aug 31 '18 at 14:02
  • `-noshadow` is an xUnit argument, so you'll need to put it in the `targetargs` if you haven't already tried that. – reduckted Sep 02 '18 at 20:33
  • I tried in some ways but it did not work. I tried like `-targetargs:"(...)InterpretadorFaleConoscoWexTests.dll -noshadow"` or `-targetargs:"-noshadow (...)InterpretadorFaleConoscoWexTests.dll"` But it always returns an error. How should I do? – Artur Quirino Sep 03 '18 at 20:23

1 Answers1

1

Can you try adding -noshadow switch to your command?

Mac
  • 949
  • 8
  • 12
  • I tried that too. But I get an error saying that this is not a valid argument. And the oficial documentation [here](https://github.com/opencover/opencover/wiki/Usage) does not show this argument. So maybe it was deprecated, I don't know. – Artur Quirino Sep 02 '18 at 20:24
  • I see, you can maybe ask the developer of open-cover directly, https://github.com/OpenCover/opencover/issues/721#issuecomment-324506844 – Mac Sep 02 '18 at 23:22