About Me

Training

Nothin But .Net Developer Bootcamp

Navigation

Search

Categories

On this page

Archive

Blogroll

 Agile Developer Venkat's Blog
 Ayende @ Blog
 B#
 Barry Gervin's Software Architecture Perspectives
 Boy Meets World
 Brad Abrams
 Canadian Developers
 Christopher Steen
 Claritude Software News
 Clemens Vasters: Enterprise Development and Alien Abductions
 Coding Horror
 Coding in an Igloo
 Dare Obasanjo aka Carnage4Life
 Darrell Norton's Blog [MVP]
 David Hayden [MVP C#]
 Don Box's Spoutlet
 Eric Gunnerson's C# Compendium
 EZWeb guy: Jeffrey Palermo [C# MVP]
 Fear and Loathing
 Generalities & Details: Adventures in the High-tech Underbelly
 Greg Young [MVP]
 Greg's Cool [Insert Clever Name] of the Day
 IanG on Tap
 Ingo Rammer's Weblog
 ISerializable - Roy Osherove's Blog
 James Kovacs' Weblog
 Jason Haley
 Jean-Luc David
 Jeremy D. Miller -- The Shade Tree Developer
 JetBrains .NET Tools Blog
 Jimmy Nilsson's weblog
 John Bristowe's Weblog
 John Papa [MVP C#]
 Jon Skeet's Coding Blog
 JonGalloway.ToString()
 Jump the Fence or Walk Around
 Lambda the Ultimate - Programming Languages Weblog
 Larkware News
 Lutz Roeder
 Marquee de Sells: Chris's insight outlet
 Martin Fowler's Bliki
 Mike Nichols - SonOfNun Technology
 MSDN Magazine - .NET Matters
 MSDN Magazine - All Articles
 OdeToCode Blogs
 Onion Blog
 Planet TW
 Raymond Lewallen [MVP]
 Rockford Lhotka
 RodMan's Corner
 Roger Johansson's blog
 Sahil Malik - blah.winsmarts.com
 Sam Gentile's Blog
 Scott Bellware [MVP]
 Scott Hanselman's Computer Zen
 ScottGu's Blog
 secretGeek
 Service Station, by Aaron Skonnard
 Signum sine tinnitu--by Guy Kawasaki
 Stephen Toub
 Steve Eichert's Blog
 Steven Rockarts
 The Blog Ride
 The Coding Hillbilly
 The Daily WTF
 TheServerSide.net: News
 Tim Gifford
 Vance Morrison's Weblog
 you've been HAACKED

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

RSS 2.0 | Atom 1.0 | CDF

Send mail to the author(s) E-mail

Total Posts: 519
This Year: 28
This Month: 0
This Week: 0
Comments: 1593

Searched for : bdddoc
Thursday, January 22, 2009 1:36:00 PM (Mountain Standard Time, UTC-07:00) ( Programming )

A couple of people have asked about where the source code I placed on google code had moved. It has all been moved over to assembla. Here are the projects that are currently up there:

bdddoc - http://svn2.assembla.com/svn/bdddoc – Tool for generating html documents based on your unit tests. Works with any attribute driven testing framework.


jpboodhoo.bdd - http://subversion.assembla.com/svn/jpboodhoo_bdd – Library that contains my current approach to writing tests. Is basically a thin wrapper on top of MBUnit 2 that has a much more natural feel to it. If you want some examples of how to write tests with this, please send email requests for a blog post!!


nbdn_web_store - http://svn2.assembla.com/svn/nbdn_web_store – Web store project that was harvested from the 2008 Germany Nothin But .Net course. Demonstrates the use of front controller architecture, fluent interfaces, bdd, interface based programming etc…

Develop With Passion!!

Comments [3] | | # 
Tuesday, November 25, 2008 5:15:00 PM (Mountain Standard Time, UTC-07:00) ( Tools )

In the Las Vegas edition of Nothin But .Net my TA  Scott Cowan made some updates to BDDDoc. BDDDoc is a tool I wrote that you can use to quickly generate a simple HTML report based on your test classes. Scott added an update to integrate with the test results of MbUnit (currently the tool can report against any codebase regardless of the testing framework being used). Now the report also shows coloring red/green depending on whether a given observation is passing or not. Here is a screenshot of a portion of what the new report looks like:

image

The tool currently takes advantage of my current naming style to generate natural sentences from the names of the concerns and observations.

Develop With Passion!!

Comments [2] | | # 
Monday, August 25, 2008 9:42:24 PM (Mountain Standard Time, UTC-07:00) ( Tools )

For the last couple of courses I have been using a tool to generate simple natural language reports using  simple BDD Naming Styles. Just so everyone knows, the insipiration for this tool came from Scott Bellware and his tool SpecUnit. The only different between the tools is bdddoc is really just a categorization/reporting tools for your tests.

People who are already trying to adopt a more BDD oriented approach to writing their tests will find the tool useful for generating natural english reports from the testfixtures in your project.

If you run the tool against the prep exercise that I posted a while ago, you would get the following report.

To use the tool you simply add a reference to the bdddoc.dll from the project that contains your test. There is only one attribute that means anything of significance:

using System; namespace bdddoc.core { [AttributeUsage(AttributeTargets.Class)] public class ConcernAttribute : Attribute { public Type concerned_with { get; private set; } public ConcernAttribute(Type concern) { this.concerned_with = concern; } } }
 

With this attribute in hand all you have to do is mark up your test fixtures with the Concern attribute. Here is an example of one full test fixture.

using bdddoc.core; using bdddoc.spechelpers; using Observation = MbUnit.Framework.TestAttribute; namespace bdddoc.domain { [Concern(typeof (ConcernFactory))] public class when_a_concern_factory_is_told_to_create_a_concern_from_a_type : ContextSpecification<IConcernFactory> { private IConcern concern; private IObservationSpecification observation_specification; protected override void establish_context() { observation_specification = dependency<IObservationSpecification>(); observation_specification.setup_result(x => x.IsSatisfiedBy(null)).IgnoreArguments().Return(true); sut = create_sut(); } protected override void because() { concern = sut.create_concern_from(typeof (when_a_decimal_is_told_to_subtract_itself_to_another_number), observation_specification); } [Observation] public void should_create_a_concern_with_the_correct_bdd_style_name() { concern.name.should_be_equal_to(typeof (when_a_decimal_is_told_to_subtract_itself_to_another_number).Name.as_bdd_style_name()); } [Observation] public void should_create_a_concern_populated_with_all_of_the_observations_satisfied_by_the_specification() { concern.total_number_of_observations.should_be_equal_to(3); } protected override IConcernFactory create_sut() { return new ConcernFactory(); } } }

Don't be too put off by the naming style. Notice how I am making use of aliasing to alias the TestAttribute to use the word Observation. This eliminates the need to add another attribute to the bdddoc assembly. This also means that once you have placed the concern attribute on your test fixtures (keep in mind that the type argument for the constructor is the System Under Test) you will be able to run bdddoc again nunit, mbunit, or others (so far it has only been tested with mbunit and nunit).

When bdddoc is run (assuming that the class above was the only test fixture in the assembly, you would get the following output:

Concerns: 1 - Observations: 2

  • Behaviour of: ConcernFactory [ 1 Concern(s) , 2 Observation(s) ]
    • when a concern factory is told to create a concern from a type
      • should create a concern with the correct bdd style name
      • should create a concern populated with all of the observations satsified by the specification

This post is not going to talk about how I currently organize my contexts and observations (fixtures/tests respectively). After either the next course in London or the one in Dusseldorf in September, I am going to update the google code project for the Nothin But .Net store project to demonstrate some more complex tests that make use of mock, separating contexts etc.

Here is the build task that I use to run the report for my projects:

<target name="run.test.report" depends="setup.test">
    <exec program="bdddoc.console.exe"
        basedir="${third.party.tools.dir}\bdddoc\bin"
        workingdir="${build.artifacts.dir}"

        >
        <arg file="${build.artifacts.dir}\${nothinbutdotnetprep.lib}"/>
        <arg value="TestAttribute"/>
        <arg file="${build.artifacts.dir}\SpecReport.html"/>
    </exec>
</target>

 

The source code for the project can be downloaded here. I am going to place it up on my google code space, but currently I have having trouble with the account.

This project was built very quickly in a top down fashion, at the end of the day it is simply reflection and text writing. I just find working top down a very quick way to solve a problem, with the side effect of potentially more players brought into the mix (see the interfaces and classess!!). You can take a look at a lot of the tests to get a feel for how I am making use of AAA style testing and extension methods everyone to support more fluent testing. Feel free to change the code anywhere you see fit. If you add anything cool, please try and get it back to me to share with the rest of the community. Right now the actual report writer (SimpleHtmlReportWriter) is just that, very simple!! If anyone feels like submitting a writer that uses some XSL and some nice stylesheets, it would be great!!

To build the project just point a command prompt to the build folder and type the following command: build package. This will place the console runner and dll into the following folder build\latestpackage.

If you just want to get the binaries download this file and extract.

Develop With Passion!!

Comments [0] | | #