BDD Surprise: R# Usage Scenarios

I had to blog about this because it brought a smile to my face when I saw it.

After some discussion yesterday over the benefits of implementing a REST model in ASP.Net MVC.  I was up late last night looking over the MVCContrib project.  I came across Adam Tybor’s SimplyRestful contribution.

When I look at most OSS project I usually look at the objects implementation first and then I look for the test coverage.

I found a class named “RestfulActionResolver”, the name alone peek my curiosity.  I noticed this class had a ResolveActionMethod that would seem to, resolve the action. :-)   I used ReSharper to find the usages of this method to see just how it was being acted upon by other objects(ctrl-alt-F7). 

What appeared next shocked me:

image

 

The top of the report read like a normal test suite no surprise there but then I quickly noticed the bottom two entries!

image

Two things shocked me!

  1. Usage of BDD context/action/behavior (sweet!)
  2. How well it read from a usage report perspective (double sweet!)

Most of you that read my blog love OSS.  I sometimes hate to go into a project and figure out how some OSS project actually works.  Lets face it documentation is very pore on OSS projects.  But by utilizing a BDD approach the test fixtures and test become self describing meta data for comprehending the intentions and actions of the code. 

I know there has been some debate on should the specification files contain multiple class entries defining context.

Ex:

  • File Name: SimplyRestfulSpecs.cs
    • [TestFixture]
      [Category("SimplyRestfulSpecs")]
      public class When_The_Form_Is_Posted_With_A_Form_Field_Named_Method_And_A_Value_Of_PUT

      [TestFixture]
      [Category("SimplyRestfulSpecs")]
      public class When_The_Form_Is_Posted_With_A_Form_Field_Named_Method_And_A_Value_Of_DELETE

Well chalk this one up in the “Favor” column for “multiple class entries defining context”.  With out this I don’t know if the report would have read as well.

Happy coding!

 

    Related Articles:

    Post Footer automatically generated by Add Post Footer Plugin for wordpress.

    About Joe Ocampo

    My personal philosophy is simple: "Have a good strategy that sets the environment for success through the enablement of the whole. Be agile but with a mind towards pragmatism. Delegate to the best qualified individuals, but don’t be afraid to involve yourself in all parts of a job. Treat everyone with respect, humility, and with a genuine pursuit towards excellence." Respected business and technical leader with expertise in directing organization towards effective results driven outcomes. Proven ability to perform and communicate from both technical and business perspectives. Strong technical and business acumen developed through experience, education and training. Provides the ability to utilize technology, harness business intelligence and execute strategically by optimizing systems, tools and process. Passionate about building people, companies and software by containing cost, maximizing operational throughput and capitalize on revenue. Looks to leverage the strengths of individuals and grow the organization to their maximum potential by harnessing the power of their collective whole and deliver results. Co-Founder of LosTechies.com
    This entry was posted in altnetconf, BDD (Behavior Driven Development). Bookmark the permalink. Follow any comments here with the RSS feed for this post.

    2 Responses to BDD Surprise: R# Usage Scenarios

    1. Adam Tybor says:

      Actually that was a discussion I tried to start on the group in MVC Contrib, nobody seemed interested. One about stories and two about testing conventions.

      Dave just had a nice post about BDD, I am still struggling to find my happy place.

      Oh, those “Normal Tests” will be refactored soon to a more BDD like tests.

    2. Joe Ocampo says:

      As a community we are still discovering all the idioms that go into BDD. But as more and more developers start to practice the constructs the feedback loop is even more critical.

      David, JP and Scott have done a good job a spreading the concepts to the community. David’s spec fixture is pretty nice since it encapsulates the Rhino and context setup for you. Very nice.

      Curious how was your experience with BDD?