tags:

views:

79

answers:

1

I've got a unit test project using NUnit. When I add the mspec (machine.specifications) assembly to the references, both ReSharper and TestDriven.Net stop running the NUnit tests and only run the mspec tests.

Is there a way or setting that allows both NUnit & mspec tests to co-exist and run in the same project using R# & TD.Net test runners?

A: 

I've just tested this on VS 2008 with ReSharper 5.0 and TestDriven.Net 3.0 RC2 and the following code.

using Machine.Specifications;

using NUnit.Framework;

namespace ClassLibrary1
{
    [TestFixture]
    public class FooTests
    {
        [Test]
        public void Bar()
        {
            Assert.IsTrue(true);
        }
    }

    public class When_tests_are_run
    {
        It should_succeed = () => true.ShouldBeTrue();
    }
}

I cannot reproduce the behavior you describe with the ReSharper. First off, ReSharper detects both test classes as indicated by the green-and-yellow gutter marks. Right-clicking on the project and selecting "Run Unit Tests" runs both tests successfully. Running them individually via the gutter icons also works as expected.

As for TestDriven.Net, I'm not sure whether it supports scenarios where multiple test frameworks are used within one project. When I "Run Test(s)" on the project, only the MSpec context is executed. However, "Run Test(s)" while clicking inside the NUnit TestFixture executes the NUnit test.

Alexander Groß
At the moment, I can't get R# to run any mspec tests :-( I'll have to have a fiddle around... WRT TD.NET, it's running all tests in the project that I'd like. I see the same behaviour that you do :-(
Mike Scott
What do you mean by R# not running any test? You see gutter icons? Are tests added to the Unit Test Session window? Do the unit test icons turn gray instead of green when the test has been executed?
Alexander Groß