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

2

13

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.
Orebro answered 9/11, 2011 at 19:31 Comment(5)
Does the rest of TDD.net work? Meaning can you actually run tests via TDD.net and get results?Baillie
Also, are you using the built in old versions of NCover that ship with TDD.net or a new purchased copy of NCover?Baillie
@Baillie : Yes, the rest of TDD.net works. I'm using the version of NCover that came with TDD.net.Orebro
is your actual goal to have an XML file or do you ultimately just want some way of visualising your coverage?Celestinecelestite
I'm going to kind of cheat here and pre-emptively give more answers than requested. The XML file is pretty empty; if I recall correctly, it only has the root element (but see, I can't write that it's "empty" because I know it isn't. :) ). I'm pretty sure NCover can handle a XML file as long as it has content so my goal for now is to get a working XML file. However, if an asteriod wipes out TDD.net, then I'd just want some way of visualizing my coverage.Orebro
O
0
  1. Uninstall the Beta version of TestDriven.net
  2. Install the RTM version of TestDriven.net

The 2 steps work because NCover's profiler is not registered properly, as described by KiwiDude.

Orebro answered 12/1, 2012 at 5:16 Comment(0)
C
2

(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.

Cabana answered 6/1, 2012 at 13:40 Comment(5)
I'm on 64-bit Windows 7 Ultimate, but everything else is the same and it works fine for me too.Illiterate
Just tried reproducing the issue today and now, I don't even get an XML file. Details are in the main question post.Orebro
@Zian Choy Kinda relevant info you added in the edit there... There may be a solution - see my edited answer. Goodluck :-)Cabana
Strangely enough, simply uninstalling the beta and reinstalling the RTM version solved the problem. I suspect that the TestDriven.Net uninstaller for the RTM version does not remove the NCover registration, which would've caused problems. Apparently, the beta uninstaller fixed that.Orebro
Unfortunately, since "uninstall and reinstall" isn't the crux of your post, I can't mark it as the answer so I'll give you an up vote.Orebro
O
0
  1. Uninstall the Beta version of TestDriven.net
  2. Install the RTM version of TestDriven.net

The 2 steps work because NCover's profiler is not registered properly, as described by KiwiDude.

Orebro answered 12/1, 2012 at 5:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.