Unit testing in Visual C# 2010 Express?

Does Visual C# 2010 Express have a unit testing feature?


Solution 1:

As has been stated, the Express versions do not have any built-in, and do not allow add-ins for, this functionality, but you can use an external tool, e.g. NUnit.

You can also set up a command to run from the 'Tools->External Tools' menu option from within Visual Studio Express and run your test runner from that if you wish.

Here is a link that shows how to do it with VS C# 2008 Express, (scroll down to the end) but I think it should hold true for 2010 as well.

Here is a new working link.

Solution 2:

Nothing built in, but you can always use nUnit with it.

MSTest comes bundled with the Pro edition and above.

Solution 3:

In 2010 it's possible using an external application, however debugging unit tests becomes difficult. If you want debugging using NUnit is probably the best route (but not the only option, see ExpressUnit). See this answer on another SO thread. It links to a blog that mentions running the test project as a console application and calling the nunit library dlls directly to launch the tests:

using System;

namespace RunTests
{
    static class Program
    {
        [STAThread]
        static void Main()
        {
            var args = new string[] { Assembly.GetExecutingAssembly().Location, "/run" };
            NUnit.Gui.AppEntry.Main(args);
        }
    }
}

Solution 4:

Visual Studio Express editions have the limitation that plugins/addins are expressely disallowed. They do not ship with a built-in testing solution, and you cannot add-in one.

Your best/only option it to use a standalone test runner, such as nUnit, mspec, etc... and run it externally from VSE.

Solution 5:

This is now included in Visual Studio 2013 Express: http://msdn.microsoft.com/en-us/library/dd264975.aspx

If Test Explorer is not visible, choose Test on the Visual Studio menu, choose Windows, and then choose Test Explorer.

enter image description here