how to debug with xUnit?

chronodekar picture chronodekar · Jun 26, 2012 · Viewed 19.9k times · Source

I'm learning xUnit and so far, have found it to be a most useful tool. It's making me rethink some of my coding tactics to TDD instead.

However, I've come across an interesting problem. My test case is failing. No real concern there, but how do I debug it?

Specifically my test case is failing due to a "out of index" error, or something similar. It's NOT failing at the assert statement. What I need now, is some way to run the test case with the Visual Studio debugger active so that I can see the status of the different variables.

I'm not going to post code, as this situation is bound to come up again. Does anyone have any idea HOW to debug the test case itself?

Almost forgot! I'm using,

  • Visual Studio 2010 Ultimate (Dreamspark license)
  • xUnit 1.9

My workflow involves using the xUnit GUI runner to run the tests.

If what I'm asking is impossible, can someone suggest an alternative test suite I could use that has what I want?

Answer

bbsimonbb picture bbsimonbb · May 26, 2016

In VS2015 and later, install the xunit.runner.visualstudio NuGet package. Then debugging is as easy as right-clicking on the test in the test explorer window. (Test-->Windows-->TestExplorer if you can't see it).

enter image description here