Search code examples
tfstfsbuildopencovervstest

OpenCover- Open cover saying missing PDBs when working with vstest.console.ex in tfs build definiton


I am trying to integrate Opencover with TFS2013 for custom code coverage. I am passing the parameters necessary for running Open Cover via build definiton nad invoking OC using a InvokeProcess activity in the build process template.

I am following the procees mentioned in this blog , here and here.

The final OpenCover arguments passed are

OpenCover.Console.exe -register:user  -target:"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe"  -targetargs:"<build_definition_folder>\bin\NUnitTestDemo.dll <build_definition_folder>\bin\UnitTest.dll  /Platform:X86 /Framework:Framework45 /Logger:trx "  -targetdir:"<build_definition_folder>\bin"  -mergebyhash  -output:"<build_definition_folder>\bin\results.xml"

The output is coming as

Total tests: 2. Passed: 2. Failed: 0. Skipped: 0.

Test Run Successful.

Test execution time: 0.6657 Seconds

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.

Please help me. The PDBs are present in the same bin folder only. I tried running Open cover locally in my machine with Open Cover UI and it is giving the results well. but with console application it is not working as i expected in the build server.


Solution

  • I met this issue before and it was because my build service is running with "Network Service" account. After I changed it to run with an administrator account, it works correctly, result is generated successfully.

    My fix: Stop the build service and change the settings in "Properties" to run the service as an Administrator account. And then start the build service and queue a new build.enter image description here