Failure is inevitable

NAVIGATION - SEARCH Launched, SpecsFor 2.2 Released!

The last month has been a busy one for SpecsFor.  I’ve added numerous new features to accommodate additional testing styles and to simplify testing challenges.  I’ve also been hard at work on a real site and some docs for SpecsFor.  I’m pleased to announce that is now live.  I’ve also shipped a new version of SpecsFor that simplifies the painful task of creating multiple mocks of the same type for injection into IEnumerable parameters. More...

SpecsFor.Mvc – Acceptance Testing Without Magic Strings

Today I published the first preview release of the next member of the SpecsFor family: SpecsFor.Mvc!  SpecsFor.Mvc is a stand-alone library designed to simplify and streamline the creation of acceptance tests for ASP.NET MVC applications.  Read on to find out how easy it is to start crafting automated acceptance tests with SpecsFor.Mvc today! More...

SpecsFor 2.0 Released!

Things have been quiet lately for my BDD framework, SpecsFor, but I have finally published version 2.0 to both Github and NuGet.  Read on to find out what’s changed. More...

Data Access in Fail Tracker–Unit Testing

In my last post, I described Fail Tracker’s simple repository model for abstracting LINQ to NHibernate, which is used for all data access in Fail Tracker.  One reason I chose to implement an abstraction around NHibernate’s ISession interface was to facilitate Test Driven Development, a practice that wasn’t really feasible given how LINQ to NHibernate is implemented as an unmockable extension method.  While the abstraction made data access mockable, it would still have been painful if it weren’t for a base SpecsFor context that handled all the heavy lifting.  More...

SpecsFor: New Release and A New Home

Good news, everyone!  There’s a new release of SpecsFor out today.  Version 1.1 is a minor update that ships with some additional Resharper Live Templates as well as some Visual Studio snippets for those that are not drinking the Resharper Koolaide (thanks to Brady Gaster) .  Additionally, SpecsFor is moving!  I’m now on the Github bandwagon (and loving it!), so all code, documentation, and releases will now reside there.  New Templates One of the big time-savers of using SpecsFor is the set of Resharper Live Templates (and now, Visual Studio snippets!) that help you create your test scenarios quickly and painlessly.  SpecsFor actually supports may different patterns for specifying context, and I tell people that they should use which ever approach feels most natural to them.  For some, that’s the attribute-based approach for specifying context: [Given(typeof(TheCarIsNotRunning), typeof(TheCarIsParked))] [Given(typeof(TheCarIsNotRunning))] public class when_the_key_is_turned : SpecsFor<Car> { public when_the_key_is_turned(Type[] context) : base(context){} protected override void When() { SUT.TurnKey(); } [Test] public void then_it_starts_the_engine() { GetMockFor<IEngine>() .Verify(e => e.Start()); } } Some prefer to put the context directly in the specs: public class when_the_key_is_turned_alternate_style : SpecsFor<Car> { protected override void Given() { Given<TheCarIsNotRunning>(); Given<TheCarIsParked>(); base.Given(); } protected override void When() { SUT.TurnKey(); } [Test] public void then_it_starts_the_engine() { GetMockFor<IEngine>() .Verify(e => e.Start()); } } And others (myself included) like the approach of putting context in a base class: public class when_the_key_is_turned : given.the_car_is_not_running_and_parked { protected override void When() { } } public static class given { public abstract class the_car_is_not_running_and_parked : SpecsFor<Car> { protected override void Given() { } } } The last release of SpecsFor only shipped with Live Templates for the attribute-based approach.  Going forward, I want to have templates for each approach, enabling users to import whichever set of templates they prefer.  This release is a step in that direction.  Just import either Attribute-* or Inheritance-* templates, and off you go!  What To Do Next? I have many ideas for where to take SpecsFor next, but I’m not sure what’s actually important to users.  If there’s something you’d like to see in the next version, or some scenario that SpecsFor doesn’t handle elegantly, please let me know: submit an issue on Github. 

SpecsFor V1.0 Released!

The first full, non-beta release of SpecsFor is finally out the door.  This release enables BDD style testing using NUnit, Moq, and StructureMap’s auto-mocking container.  You can grab the binary release from the CodePlex site, or you may use NuGet instead. The current version of SpecsFor depends on a few strongly-named packages.  These dependencies will be softened in the next release (more on that below), but you might run into versioning issues when using NuGet as David Ebbo described very well.  Fortunately NuGet’s ‘Add-BindingRedirect’ cmdlet works very well and will sort things out for you automatically.  What’s next?  Who knows, but maybe… Support for the auto-mocking container of your choice. Support for other testing frameworks (MS Test, MbUnit). Integration with UI testing libraries. Improvements to further reduce testing friction. Got an idea?  Submit it!