Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get TestDriven.net to generate a useful code coverage XML file with NCover?

Steps to Repro:

  1. Make a C# project in VS 2010 Professional on Windows 7 Ultimate 32-bit edition.
  2. Write some unit tests with the VS C# Unit Test wizard
  3. Download and install the latest RTM or Beta version of TestDriven.Net.
  4. Right-click on the testing project and select Test With NCover
  5. Wait
  6. See that NCover's window is empty

How do I get TestDriven.net to generate a useful code coverage XML file with NCover?

So far, I've tried rebooting, uninstalling the RTM version and installing the Beta version, and running in Debug & Release modes.

Update with Output window text:

------ Test started: Assembly: TestProject1.dll ------

NCover v1.5.8 - Code Coverage Analysis for .NET - http://ncover.com

NCover.Console v1.5.8 - Code Coverage Analysis for .NET - http://ncover.org
Copyright (c) 2004-2006 Peter Waldschmidt


Command: C:\Program Files\TestDriven.NET 3\ProcessInvocation86.exe
Command Args: "/assemblyName:TestDriven.TestRunner.Server, Version=3.2.2770.0, Culture=neutral, PublicKeyToken=50ecb853f8c6b8d2" "/xmlName:M:TestDriven.TestRunner.Coverage.NCoverCoverageTestRunner.OutOfProc.Run(System.String,System.String,System.String,System.String,System.String)" "/parameter:tcp://127.0.0.1:64445/7dbdb535-3602-4a8e-8bbc-f8be7eb83987" "/parameter:tcp://127.0.0.1:64445/fbff4f73-2438-43e4-b1f9-2bdaeb9c0907" "/parameter:C:\Users\Zian\Documents\Visual Studio 2010\Projects\ClassLibrary1\TestProject1\bin\Debug\TestProject1.dll" "/parameter" "/parameter"
Working Directory: 
Assemblies: ClassLibrary1;ClassLibrary1_Accessor;TestProject1
Coverage Xml: C:\Users\Zian\AppData\Local\Temp\Mutant Design\TestDriven.NET 2.0\Coverage\ClassLibrary1\TestProject1.xml
Coverage Log: Coverage.Log

Waiting for profiled application to connect...Connected
Configuring Profiler...
******************* Program Output *******************
Unable to establish communications with the profiler. (0x2)

NCover couldn't create a coverage report.
like image 217
Zian Choy Avatar asked Nov 09 '11 19:11

Zian Choy


1 Answers

(Assuming you are using NCover 1.5.8 which ship with TDD.Net)

I've done exactly what you described, and it works just fine... Here are some things to consider:

  1. Are you sure the actual xml file is empty? Try to look for it here: C:\Users\USERNAME\AppData\Local\Temp\Mutant Design\TestDriven.NET 2.0\Coverage\YOURPROJECT, or use something like Everything (great free search tool) to find YourTestProject.xml. Perhaps there is a problem with the NCover GUI.
  2. There have been some problems with MSTest & NCover integration prior to 1.5.8. Try to reproduce this with NUnit and see what happens (Actually IMHO, I don't see any advantage for MSTest over NUnit anyway).
  3. Are you running any other profiler in addition to NCover? Is so, try to disable them.

EDIT: Try to follow the steps in this article. There's a section called "NCover With TestDriven.NET".
It seems as NCover's profiler is not registered properly, so mainly what you have to do is remove it manually completely (TDD.Net probably doesn't do it for you), and only then reinstall it.

like image 74
seldary Avatar answered Oct 04 '22 03:10

seldary