Well the first one I heard has been overcome for certain tools (well briefly anyway).
As to the second issue I found a workaround on my net travels - thought it would be good to document it here.
Basically you modify the
<StartAction>Program</StartAction>
<StartProgram>C:\Program Files\NUnit-Net-2.0 2.2.8\bin\nunit-gui.exe</StartProgram>
under the PropertyGroup element.
Now when you press 'F5' it should fire up a debuggable NUnit session.
This could be used to fire up any process - Windows Live Writer instances to test your plug-ins for instance ;)
Note: Untested by me as of yet - will test when I get a chance and I'll remove this note.
Thanks for the tip - I got this to work with some refinement.
ReplyDeleteThere is an easy way to debug NUnit tests from Visual C# Express, which has the advantages of:
ReplyDelete* not invoking the NUnit GUI; and
* not popping up an external console window; and
* piping output to Visual Studio's output window; and
* not requiring hacking the .csproj file...
Simply:
0. Add a reference to nunit-console-runner in your test assembly.
1. In your test assembly, make a class with the following one liner:
using System;
namespace MotorExampleTests
{
// Written by blokeley
class NUnitConsoleRunner
{
[STAThread]
static void Main(string[] args)
{
NUnit.ConsoleRunner.Runner.Main(args);
}
}
}
2. Open your test assembly's properties. For example, right-click on the assembly and select Properties.
3. On the Application tab, select Output Type: Windows Application; and Startup Object: NUNitConolseRunner (the file above).
4. On the Debug tab, enter the .csproj file name in Command Line Arguments; and browse to the folder of the .csproj file in Working Directory.
5. Save everything, set a breakpoint and run using F5 or the green arrow button.
that's a great tip!
ReplyDeleteThanks! Saved me a lot of time
I can't put "nunit-console-runner" on startup object ?
ReplyDeleteI just can put my assembly ...
Gooooood tip. Thank alot.
ReplyDeleteI tried this and it works like a charm. However, when a test fails, I am unable to click on the failing test and automatically go to the file and line number that asserted. Is there a way to format the test output for this to work?
ReplyDelete