1
votes

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?

1
Are you missing [TestFixture] attribute from the class? This would be on the nested class when_a_user_adds_an_event inside.Andez
This is not a problem because the SpecsFor base class has a [TestFixture] attribute.BitSchupser

1 Answers

3
votes

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.