Daily Usage Issues

NUnit generic test fixtures report "same name" error

Started by jamiehumphries on 5,251 views

Hello,

I am using NUnit's TestFixture attribute to set up parameterized test fixtures.

Unfortunately, NCrunch is only running them under the first set of parameters and giving me an error message like:
NUnit tests have been detected with the same name

This project contains multiple NUnit tests that share the same name. This prevents NCrunch from uniquely identifying tests during their discovery and execution, distorting the reporting of test results. Ensure your tests always have a unique name within the scope of their project.


This is within the normal documented use cases of the TestFixture attribute, so is just a bug in NCrunch?

An example of such a test fixture is below (or see this Gist).
namespace NCrunchNUnitBug
{
    using NUnit.Framework;

    [TestFixture(23)]
    [TestFixture(42)]
    public class GenericTestFixture
    {
        private readonly int number;

        public GenericTestFixture(int number)
        {
            this.number = number;
        }

        [Test]
        public void Only_runs_once_under_NCrunch()
        {
            Assert.That(number, Is.EqualTo(23));
        }
    }
}

NCrunch inline coverage will report this as green because the first set of parameters (number = 23) passes the test, and will not run it with the second set of parameters (number = 42)

My environment is:

  • NCrunch 2.19.0.4
  • NUnit 3.0.1
  • Visual Studio Enterprise 2015
  • (Windows 10)


Thanks,
Jamie

Edited

Thanks Remco, I had a quick look around but missed that other thread. Glad to hear it is being worked on :)

Post a reply

Log in to reply.