How do I get ReSharper to recognize ALL my Unit Tests?

Using NUnit, I have 331 unit tests in the current solution. ReSharper can find 209 of them. I don't get the little yellow/green bubbles next to all of [Test] or [TestFixture] attributes. They don't show up in the Unit Test Explorer. The test fixtures all all public classes, and nothing else seems amiss.

NUnit finds/runs them all 331 from outside the solution, and TestDriven finds/runs them all 331 from inside the solution.

What I've tried so far:
Browsing thru the unit test projects, trying to run all from the test fixture.
The Unit Test Explorer.
"Show All Unit Tests" from the Unit Test Session.
Menu: ReSharper, Unit Testing, Run All Unit Tests From Solution
Deleted the "_ReSharper.foo" directory, and the "foo.Resharper.user" file, hoping that would force ReSharper to re-evaluate the test count.

2 comments
Comment actions Permalink

For example, ReSharper doesn't recognize this unit test, but it sees others in the same assembly:

using System.Collections.Generic;
using System.Data;
using NMock2;
using NUnit.Framework;
using WDS.DART.BusinessObjects;
using WDS.DART.BusinessServices;
using WDS.DART.TestUtilities;
using WDS.DataServices;

namespace WDS.DART.BusinessServicesTest
{
    [TestFixture]
    public class OverrideHanderFixture
    {
        private OverrideHander _instance;
        private DataServices.IFactory _factoryMock;
        private IDataSource _dataSourceMock;
        private Mockery _mocks;
        private DataTable _fakeReasonsTable;
        private DataFakes _dataFakes;
        
        [SetUp]
        public void SetUp()
        {
            _mocks = new Mockery();
            _dataFakes = new DataFakes();
            _fakeReasonsTable = _dataFakes.GetFakeReasonsTable();
            _factoryMock = (DataServices.IFactory)_mocks.NewMock(typeof(DataServices.IFactory));
            _dataSourceMock = (IDataSource)_mocks.NewMock(typeof(IDataSource));
            Expect.AtLeast(1).On(_factoryMock).Method("CreateDataSource").Will(Return.Value(_dataSourceMock));
            _instance = new OverrideHander(_factoryMock);
        }

        [Test]
        public void CanGetOverrideReasons()
        {
            Expect.Once.On(_dataSourceMock).Method("GetOverrideReasons").Will(Return.Value(_fakeReasonsTable));
            List<IOverrideReason>[] reasons = _instance.GetOverrideReasons();
            Assert.AreEqual(0, reasons[0].Count);
            Assert.AreEqual(4, reasons[1].Count);
            Assert.AreEqual(2, reasons[2].Count);
            Assert.AreEqual(3, reasons[3].Count);
            Assert.AreEqual(1, reasons[4].Count);
            foreach (IOverrideReason reason in reasons[1])
            {
                Assert.IsTrue(reason.Description.StartsWith("ignore"));
            }
        }

        // more tests here...
    }
}

0
Comment actions Permalink

Hello Bob
     Could you please attach a full sample solution here? Thank you!

Andrey Serebryansky

Support Engineer

JetBrains, Inc

http://www.jetbrains.com

"Develop with pleasure!"

0

Please sign in to leave a comment.