.net alternatives

by Michel Grootjans
posts - 50, comments - 84, trackbacks - 1

My Links

News

Shelfari: Book reviews on your book blog

Twitter












Archives

Post Categories

Nothin but .net, here I come!

I have enlisted to JP Boodhoo's Nothin but .net class in Düsseldorf, Germany from September 22nd to the 26th.

To quote JP:

"This is a very intense week. Your mind will not have very much in the way of downtime. Days in past courses have gone anywhere from 10 – 20 hours in length!!"

BDDTest

He prepared a download of several items to prepare for the course. There's a 30+ minute video where he explains step by step what you should prepare on your PC before starting the class. This includes where to download some tools he uses a lot as well as scripts for ReSharper, AutoHotkey, ...

It also includes a very small VS2008 solution, prepared with 14 failing BDD-style unit tests, but without implementation. The implementation is your homework before the class.

The implementation for the tests to pass is rather straightforward. What is interesting is the setup of the project and the BDD-style test fixtures (see illustration).

The 'Concern' keyword is an attribute coming from the bddunit.core library that matches the well known 'TestFixture' of both NUnit and MbUnit. The 'Observation' attribute is just an alias for MbUnit's 'Test' attribute. This line of testing goes a long way to express more elegantly what the requirements are. Apparently, you're supposed to write one test fixture (or 'Concern') per scenario. You can add as many 'Observations' as necessary for this scenario.

Notice the amount of underscores in the code. How does this make you feel. At first, it felt messy to me. After a while though, I realized this improves readability a lot. Compare 'ShouldReturnTheNumberOfMoviesInTheLibrary' with 'Should_return_the_number_of_movies_in_the_library'. What do you think? Even my spell checker notices the difference.

A more subtle approach to readabilty can be seen in the observation:

number_of_movies.should_be_equal_to(2)

Notice the field declaration of 'number_of_movies' in the test illustration. It's just an int. An int doesn't implement 'should_be_equal_to(int otherNumber)', does it? Extension methods really rock here.

TestReportBased on the BDD tests, an HTML report can get generated. This report contains all the test specifications that have been implemented. This could be used to communicate in a non-ambiguous way with your customer. Yeah, you wish. In my experience customers are not bothered with what they feel is too 'deep inside the code'. It can however clearly communicate intent inside the development and testing team.

 

A second interesting part is the setup of the project. You don't compile or run tests in Visual Studio. You run them from the command line. The build script (in NAnt) doesn't even run the solution, it runs csc (yes, that's the C# compiler) directly, specifying all *.cs files in the 'source' directory. Those of you who run big projects will appreciate the time saved by not having to compile in VS. The tests are also run from the command line. If any of the test fails, a text file will be opened specifying which test(s) have failed. Drawback: you don't get to double click on the failed test to be taken back right to it. Notepad doesn't seem to have this feature ;-)

 

All in all, I'm really excited to have the opportunity to take this course. Be sure to check out this blog from the 22nd to the 26th.

 

 

Side note: Can you point me to a better way to post code? I heard about 'Copy as HTML', but it's site seems to be offline.

Print | posted on Tuesday, August 12, 2008 4:24 PM | Filed Under [ .net Personal ]

Feedback

Gravatar

# re: Nothin but .net, here I come!

Looking forward to meet you there. I've enlisted, too.
I think it'll be an awesome week . . .
8/28/2008 12:09 PM | Björn Rochel
Gravatar

# re: Nothin but .net, here I come!

This might help you with the source code problem:

http://code.google.com/p/syntaxhighlighter/

8/28/2008 12:12 PM | Björn Rochel
Gravatar

# re: Nothin but .net, here I come!

Hi,

I've been looking for a way to generate the html reports from the tests but have failed miserably ;-)

Would you be willing to post a short howto?

KR,
Tom
9/25/2008 12:33 PM | Tom
Gravatar

# re: Nothin but .net, here I come!

You just type
> build run_test_report
this will generate a SpecReport.html in the build\buildartifacts directory
9/25/2008 2:41 PM | Michel Grootjans
Gravatar

# re: Nothin but .net, here I come!

Just tried it in the exercise for day 1 prep solution; I get Target 'run_test_report'does not exist in the project.

I haven't altered any of the code; does it work on your machine?
9/25/2008 4:14 PM | Tom
Gravatar

# re: Nothin but .net, here I come!

Ok, my bad. For the prep material it's
> build run.test.report

JP changed it around during this week. In the course it's
> build run_test_report
but that won't work for you.
9/25/2008 4:55 PM | Michel Grootjans
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification:
 

Powered by: