Unit refuses to dsicover or run my tests in an assembly. This is not the case where Unit produces an error message like "Unable to find test in assembly". It simply doesn't discover that I have tests.
I right-click the test-method and the test output shows:
Discover test started ------ Discover test finished: 0 found (0:00:00,0260026)"
I have tried everything mentioned in this post: NUnit doesn't find tests in assembly
Upgrading is not a possiblity. The processor architecture settings are correct. My tests are public and have all the correct tags.
Here's some code from my project that I simply can't get to even execute. I know that because I have a break-point right at the beginning.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
namespace UnitTestProjects
{
[TestFixture]
public class SomeRandomTests
{
[Test]
public void ShouldFail()
{
Assert.AreEqual(1, 0);
}
[Test]
public void ShouldPass()
{
Assert.AreEqual(1,1);
}
}
}
I'm running the internal visual studio test explorer. Unit Framework version 2.5.9.10348, runtime version v2.0.50727. I have Unit Test Adopter installed. I've attempted reinstalling it with no success.
Few things to check here . 1) Make sure we are referencing the right dlls to the test project. In our case it will be NUnit3testAdapter 2) We have to restartthe visual studio so in order for the our new install extensions to take effect .
Even after trying all of this and still it doesn't work Install it as part of ToolExtensions and update and from here install the NunitTest adapter. this should definitely work.
You must either install the NUnit VSAdapter vsix extension, or add the adapter as nuget package to your solution.
The latest version is the 2.0, and the vsix is available here: https://visualstudiogallery.msdn.microsoft.com/6ab922d0-21c0-4f06-ab5f-4ecd1fe7175d
And the nuget package can be found here: http://www.nuget.org/packages/NUnitTestAdapter/
More information on these options can be found in this MSDN ALM post http://blogs.msdn.com/b/visualstudioalm/archive/2013/06/11/part-3-unit-testing-with-traits-and-code-coverage-in-visual-studio-2012-using-the-tfs-build-and-the-new-nuget-adapter-approach.aspx, which also points to two earlier posts.
If you look in the Output console window under Test, the adapter name and version is displayed there as it run. If it doesn't come up, the adapter is not active.
If you run Resharper, ensure you have the latest 8.2 version, there has been conflicts earlier with the test adapters and resharper.
Even if you can't upgrade this project from NUnit 2.5.9 to latest 2.6.4, you can verify the adapters work correctly in a test project using 2.6.4.
I just checked on my own machine with NUnit 2.5.9, and that worked nice with the 2.0 adapter.
Update:
For VS2017 you dont install the NUnit VSAdapter vsix extension, instead install the NUnit 3 TestAdapter for Visual Studio 2012 (Update 1) onwards. This works with NuGet package: NUnit 3.9.0.
Update 2 - June 2019 Just released the 2.2 version of the NUnit2 Adapter. It should now work properly with SDK type projects, and with VS 2017 and 2019.