1

I am trying to implement end to end tests using SpecsFor.Mvc. I implemented the following test:

namespace Features
{
    class AddEvents
    {

        public class when_a_user_adds_an_event: SpecsFor<MvcWebApp>
        {
            protected override void Given()
            {
                SUT.NavigateTo<HomeController>(c => c.Index());
            }
            protected override void When()
            {

                SUT.Browser.FindElementById("btn-add-event").Click();
                SUT.FindFormFor<Event>()
                    .Field(f => f.Name).SetValueTo("Alex")
                    .Field(f => f.Date).SetValueTo("01/01/2013")
                    .Submit();
            }

            [Test]
            public void then_event_should_be_added()
            {
                Assert.Fail();
            }
        }
    }
}

Problem is, that nUnit does not discover this test and reports that it did not find any tests. I had the following setup :

  • nunit-console runner Version 3.2
  • Visual Studio nUnit3 Test Adapter Version 3.0.8.0 (both did not find the test)
  • nUnit Version 3.2.0
  • Specsfor was Version 4.4.0.0
  • Specsfor.Mvc was Version 3.4.0.0
  • All Projects build with .Net 4.6

Any idea why this test is ignored by the test runners?

2
  • 1
    Are you missing [TestFixture] attribute from the class? This would be on the nested class when_a_user_adds_an_event inside. Commented Mar 11, 2016 at 13:49
  • This is not a problem because the SpecsFor base class has a [TestFixture] attribute. Commented Mar 11, 2016 at 20:39

1 Answer 1

3

There is an NUnit issue reported in relation to SpecsFor.MVC, see https://github.com/nunit/nunit/issues/1277

As far as we (nunit guys) can tell, SpecsFor doesn't support NUnit 3.0. However, that's based on a very cursory examination of their code. None of us are really familiar with it.

Frankly, the issue won't be moving very much unless somebody with in-depth knowledge of SpecsFor chimes in with advice.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for your answer, there is also a corresponding issue in the SpecsFor issue tracker (github.com/MattHoneycutt/SpecsFor/issues/87), it shows the problem I ran into: The Specsfor.Mvc Nuget package has a dependency to nUnit 3.0 but does not support it - it needs nUnit 2.x.
Charlie is correct, SpecsFor does not support NUnit 3.0. It actually depends on NUnit 2.x, not 3.0. I'll update the NuSpec so that it won't even let you upgrade to NUnit 3.0 whenever I get a chance...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.