Search code examples
xunitopencoverappveyor.net-standard

Appveyor cannot find test coverage


I have a small project (.netstandard 1.0 + net45) on github which I integrated with Appveyor. I'm using xunit for unit tests and opencover for test coverage. I cannot get Appveyor to commit test results, here is the output:

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.

Here is my script:

- .\tools\OpenCover.4.6.519\tools\OpenCover.Console.exe \ -target:"c:\Program Files\dotnet\dotnet.exe" \ -targetargs:"test -f netcoreapp1.1 -c %CONFIGURATION% Giver.Tests/Giver.Tests.csproj" \ -mergeoutput \ -hideskipped:File \ -output:opencoverCoverage.xml \ -oldStyle \ -filter:"+[Giver*]* -[Giver.*Tests*]*" \ -searchdirs:Giver.Tests/bin/%CONFIGURATION%/netcoreapp1.1 \ -register:user

DebugType is full for all projects.

I probably tried most of the combinations for OpenCover.Console arguments.

The same script works on my machine (after replacing %CONFIGURATION%).


Solution

  • Yeah, it was totally my mistake.

    If you change DebugType to Full using Project Properties page (Visual Studio), beware, it will add a condition like this:

    <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
    

    I am using Release configuration for Appveyor build, so this condition will not be met and portable .pdb will be generated (opencover only works with Full .pdb).

    After deleting this condition, everything works fine.