Blog - Microsoft .NET, ASP.NET, AJAX and more

Behavior Driven Development (BDD) with Cucumber and ASP.NET MVC

by Damien White 6/10/2010 6:18:40 PM

cucumber_logo So as I’m sure you have guessed by my last bunch of posts, I’ve been hooked on Ruby and Rails development.  The more I use it, the more I love it.  I felt I was loving it a bit too much, so decided to divert my attention back to ASP.NET MVC for a while.  While developing with Rails, I was practicing BDD with Cucumber.   I felt that Cucumber scenarios (written Gherkin) were far more useful for the majority of my testing on a web application.  Sure unit tests are worthwhile for bits of code, but I’ve found that they don’t always make sense when testing a web application (like Steve Sanderson has mentioned).  Some may argue that these tests are brittle, but honestly, I feel it defines my application better and it definitely tests the actual interactions better.  I’m fully on board for unit tests for complex processes, but the majority of web work just isn’t that complex.

I’m not going to go fully into what BDD is here, but my goal was to use a similar process when developing ASP.NET MVC applications as I did in Rails.  With Rails, it’s simple, Rails, Cucumber, Pickle, ActiveRecord, Factory Girl, Webrat, etc. work perfectly together.   In the .NET world, there are options, but nothing that really fit together as nicely.  I started with just wanting to test my basic application (menus, breadcrumbs, etc) and didn’t venture into model work yet, so I figured it would be as simple and efficient as it is in Rails.  Not so much.  I tweeted about this exact thing a while ago.  More...

Shout it kick it on DotNetKicks.com Bookmark and Share

Book Review – Manning The Art of Unit Testing

by Damien White 9/30/2009 3:57:11 PM

The Art of Unit TestingTo some, “unit testing” is a four letter word.  While it’s unfortunate, the feeling is justified by poor experiences, lack of knowledge, and so on.  Personally, I’ve had mixed experiences with unit tests.  I’m sure many of you have encountered similar situations.  After reading The Art of Unit Testing by Roy Osherove, I feel far more confident in not only understanding unit tests, but also the best practices for implementation.  If this book had only been written years ago, maybe all those poor unit testing experiences would have never happened. 

The fundamental thing that I think is most misunderstood about unit testing is simply not understanding what a unit test is.  In fact, Roy just recently posted an updated definition of how he would classify a unit test on his blog.  Of course a definition isn’t always enough, and in his book, Roy starts off by fully explaining all the aspects of what a unit test should be and the basic outline for how to succeed.  I would highly recommend that you visit his book’s webpage (http://manning.com/osherove/) and download the sample first chapter

This seriously may be the best book ever written on unit testing.  I understand that “the best” is a strong statement, but this book is really the perfect package.  Let’s look at what makes this such a winner… More...

Shout it kick it on DotNetKicks.com Bookmark and Share
Tags:
Categories: Review | C#
Actions: E-mail | Permalink | Comments (2) | Comment RSSRSS comment feed