Debugging Unit Tests

To enable debugging and stepping through unit test code when using NUnit:
In the project containing the unit tests add a reference to nunit-console-runner.dll.
Add a file to the project called NUnitConsoleRunner, for example.


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Utilities_Tests
{
    public class NUnitConsoleRunner
    {
        [STAThread]
        public static void Main(string[] args)
        {
            NUnit.ConsoleRunner.Runner.Main(args);
        }
    }
}

Under the properties for the project:
   - Application - set the output type to Windows Application.
  - Debug - set the command line arguments to the name of the executable produced, e.g. Utilities_Tests.exe, and set the working directory to where it lives.

Set the project to be the start up project.

When you hit F5 or the green arrow the unit tests will run and will stop at any break points.

Comments

Popular posts from this blog

Path environmental variable on mac

Setting up node-sass on a mac