4

The problem: My NUnit tests are not showing up in Test Explorer.

I am currently running Visual Studio Express 2013 on a 64-bit machine. At present, I have "NUnit TestAdapter including NUnit 2.6.4 framework" installed. The framework version is 2.6.4.14350, while the test adapter version is 2.0.0.0

Following these two threads (NUnit Unit tests not showing in Test Explorer with Test Adapter is installed and Visual Studio 2013 doesn't discover unit tests) on troubleshooting:

  • At present, "Active Solution Platform" is set to 64-bit for build settings for my test project (Build > Configuration Manager).

  • "Default Processor Architecture" is pointed to 64-bit under Test > Test Settings.

  • A reference to both NUnit framework and TestAdapter have been specified in the test project.

  • The test project cs file contains [TestFixture] and [Test] in the correct places
  • I have tried cleaning / rebuilding the solution multiple times
  • I have tried restarting Visual Studio multiple times
  • I have tried running Visual Studio via "Run as administrator"
  • I have tried running NUnit version 3 (framework and test adapter)

Below is my code:

using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Hello_World_Testing
{
    [TestFixture]
    public class HelloWorldTesting
    {
        [Test]
        public void subtract()
        {
            int value = 1;

            if (value == 1)
            {
                Assert.Pass();
            }
        }

        [Test]
        public void addition()
        {
            int firstValue = 1;
            int secondValue = 2;

            Assert.AreEqual(3, firstValue + secondValue);
        }
    }
}
Community
  • 1
  • 1
taylorswiftfan
  • 1,371
  • 21
  • 35
  • If the NUnit adapter is having errors, they should show up in the output window of Visual Studio under Test in the dropdown. Is there anything there? – Rob Prouse Jul 27 '16 at 20:55
  • Hi Rob. Under Output, 0 found. No error messages. Full message: ------ Discover test started ------ Discover test finished: 0 found (0:00:02.6861536) – taylorswiftfan Jul 27 '16 at 20:57
  • Can you run your tests using NUnit console? It may reveal more helpful errors. – Rob Prouse Jul 27 '16 at 22:02
  • Yes I can. I have trimmed the top, but the key section: – taylorswiftfan Jul 27 '16 at 22:34
  • Are you using the extension or the nuget for the runner? Also, any reason your tests can't be AnyCPU? – Rob Prouse Jul 27 '16 at 23:13
  • I had similar issue last year with NUnit and VS2013. You can find my question [here](http://stackoverflow.com/questions/29185267/async-nunit-test-with-await-not-listed-in-vs2013-test-explorer). TL:DR: I had a special character in the path (it was a "#") that (as far as I can tell) caused my issue. Maybe worth to check for special character in your path and/or move the project to a different path. – 1ppCH Jul 28 '16 at 12:03
  • Hi Rob - I installed the adapter and the framework via nuget (if that answers the question?). The only reason I have set it to 64-bit is so that the architecture is consistently set. I have tried AnyCPU as well, to no avail. – taylorswiftfan Aug 01 '16 at 21:02
  • Hi 1ppCH - No special character in the path. – taylorswiftfan Aug 01 '16 at 21:03

1 Answers1

6

I had this issue and this worked for me.

Close Visual Studio Go to:

C:/Users/YourUsername/AppData/Local/Temp

Rename the file called: VisualStudioTestExplorerExtensions

-Open Visual Studio and rebuild solution

Ger Mc
  • 630
  • 3
  • 11
  • 22