Showing posts with label code coverage. Show all posts
Showing posts with label code coverage. Show all posts

Tuesday, August 23, 2011

TFS 2010 - The process cannot access the file 'data.coverage' because it is being used by another process

Have you came across a situation where your build is running indefinitely and when you see stop the build, the following error is thrown:

The process cannot access the file 'data.coverage' because it is being used by another process.

This happens only when code coverage is enabled in the testsettings being used in the build. Also, you will see this issue if one of your unit tests is having an issue. To know about the root cause of the issue with the unit test, you can do the following:
  • Go to the build agent box
  • Browse to the directory where the build agent "Sources", "Binaries" and "Test Results" folder are present
  • Open the trx file in the "Test Results" folder
  • Click on "Test run error"
You will see the exact cause of the issue here.

Also, if you dont want to Stop the build forcefully and allow it to finish the execution, please follow these steps:
  • Go to the build agent box
  • Go to Task Manager and kill the process "VSPerfMon.exe"
This will allow the build to complete gracefully but you will not see any unit test and code coverage results.

Monday, March 7, 2011

TFS 2010 Build- Running unit tests with code coverage enabled on signed assemblies

For signed assemblies, running unit tests with code coverage enabled requires the key file (*.snk, *.pfx) to be specified in the "Code Coverage Detail" tab in the testsettings.

This works fine when you run the tests locally in Visual Stuio. The problem occurs when you try to use this testsettings in the TFS Build. The specified path of the key file is absolute rather than relative. Hence the key file isnt found during the build.

The solution to the problem is:
Suppose your solution directory is C:\TestSolution and your key file is present at C:\TestSolution\TestProject\Key.snk
Open the testsetting in notepad and instead of specifying the full key path, specify TestProject\Key.snk