September 2006


After a day of getting FIT I was able to run the FitNesse wiki and poke around a bit and run some more acceptance tests.  This I found very interesting and quite impressive really.  It was truly simple.  So how do I write acceptance tests for my .NET applications.

The first step is understanding how a java based FitNesse wiki ran my .NET acceptance suites.  Fortunately this was pretty easy.  Under the fitnesse install directory their is a subdirectory called dotnet.  It the dotnet directory there is a .NET implementation of the FitServer that consumes test tables and communicates back results.  All we have to do in our wiki pages to tell FitNesse to use the .NET FitServer instead of the Java one to run our acception tests.  This is done by placing the following at the top of the wiki page that you write the acceptance test in:

!define COMMAND_PATTERN {%m %p}
!define TEST_RUNNER {dotnet\FitServer.exe}
!define PATH_SEPARATOR {;}
!path dotnet\*.dll

That’s it.  Then add the following test table to your page as well

!|eg.ArithmeticColumnFixture|
|x|y|plus()|
|10 |2 |12 |
|12 |3 |15 |
|100 |4 |104 |

The syntax is simple enough. 

  • Line 1:  The test fixture to run, with eg.ArithmeticColumnFixture being a fully qualified class name 
  • Line 2:  These are public members on the test fixture in first two columns, and the final column is the method that is called to perform the test.
  • Line 3-5: These values are assigned to the test fixture members and  the plus() called.

 

 

 

This page shows an example test table as it is rendered within the FitNesse.  Notice how FitNesse displays the .NET settings of the page.

To run the test, click the Test button that is in top left hand corner of the menu items.  (Note that to make a page a Test, select properties from the menu items and choose the Test option box.)

 

 

 

 

 

After you run the test, the results are displayed.

 

 

 

 

 

 

This works okay, now how do you write you own.  Take the following steps:

  • Open your VS Studio Project with the code that you want to test.
  • Write your acceptance test fixture code
  • Have your project *.dlls copied into the FitNesse/dotnet directory (Post Build Events in VStudio are good for this).
  • Write you test table wiki page and run.

 

One thing to note.  I was build using VS Studio 2005 and FitNesse was having problems finding classes within my assembly files.  To fix this I had to checkout the latest FitNesse.DotNet from the trunk and build it (You need NAnt). 

 

Once done, I copied the required binaries into the FitNesse\dotnet directory and everything worked fine.

One of the early things on a project to get sorted is who is going to be performing acceptance tests and how are they going to be written and executed? Just so we’re clear, acceptance tests are what the customer executes to verify what you (the team) have delivered is what they (the customer) asked for? If not, its back to the old drawing board.

FIT is a Framework for Integrated Tests that was created by Ward Cunningham and is gaining popularity. FIT simply consumes test tables, where a test table is a bunch of acceptance tests with input values and expected results. The trick is to provide test tables in tools that customers use as part of the every day life, and what is more everyday than Word and/or the Web.

Focusing on the Web side of things, FitNesse is a software testing tool that front ends FIT with a wiki. In Fitnesse the customer can write acceptance tests as simple tables that can be executed. These executable test tables call the software that you wish to be accepted by the customer.

Installing Fitnesse

Hmmm. This wasn’t so hard, simply do the following:

  • Download the latest zip and unpack into a directory of your choice.

At the time of writing, the latest zip was fitnesse20060719.zip. Note that FitNesse is a wiki implemented in java. However, it does support the running of acceptance tests for .NET. Now once unpacked, step into the root directory and issue the following:

  • run -p 8888

This will display a little text to say all is well. Now traverse to the FitNesse wiki at:

Here are a couple of quick links you should try:

The last one is very interesting because in the left hand menu, you’ll see the top menu item is Suite. Click this to run all the .NET acceptance tests. Note, that you need .NET installed on your Windows machine.

I’m tired. Tomorrow I’ll step through the problems I had trying to get my own acceptance tests running against inside Fitnesse.

This was a strange book.  I simply never got into it.  If you are new to Agile and/or having problems selling Agile into your organisation then its worth a look.  It has a lot of evidence for why Iterative and Incremental Development (IID) works.   Also, if you want a reference to how different agile methods such as XP, SCRUM, Evo, and the Unified Process (UP) compare/integrate with one another then maybe worth a look.  It’s strange, it was a book I didn’t learnt anything new from but it had tons of information and/or content in.  I dunno, maybe its because I was on a course given my Craig Larman (I learnt tons there) last week and everything was a bit too fresh… 

One of the best ways to learn a new language for me is to write a load of tests that demonstrate how particular parts of the lanugage and/or platform work. For VisualStudio 2005, I wanted to do this without paying for the priviledge, so this ruled out:

  1. TestDriven.NET that is suppose to provide good test integration with VS.NET.
  2. Visual Studio Team Suite (VSTS) built in test framework. See what Charlie Poole, a member of NUnit team has to say about this.

So I installed NUnit and took the following steps within VisualStudio:

  1. Created a new VS Solution with a C# Library project called basics.
  2. Right clicked on the basics project and set the startup external program to be NUNIT_HOME/bin/nunit-gui.exe

Once done, everytime I run in debug it fires up the nunit gui and I can select my test and run it. I am now in a position to test and debug anything within the .NET platform that I can condense down into a simple test. Nice!

Again, that wasn’t so bad…

Learning the Microsoft Platform for me is like French.  You learnt it badly when you were young, stumbled by with it year in and year out, always promising yourself that one day you’ll do it properly!  For me, that day has come!

So I dusted off my First Edition of Eric Gunnerson’s (c) 2000 A Programmer’s Introduction to C# that was lying around on my bookshelf.  It’s not a great book, but a start.  4 hours later, armed with the syntactic basics of the C# language, I fire up my newly installed Visual Studio Professional.  I’m mildly excited.

The first thing I do in any new IDE is go to their equivalent of Tools | Options and step the enormous amount of configuration options, just see what’s there.  Here’s what I found interesting:

  • Environment | Help | Online - Over a slow connection, go standalone.
  • I tend to separate application from data on my desktop machines, so for me:
    • Change the default location for my Import and Exporting Settings
    • Change the default location for my vstudio projects and templates
  • Configuring the help system, msdn, C# formatting options and debugging.

Okay, I’m ready go.

 

I performed a full install of Visual Studio 2005 and MSDN today.  It took under an hour on my Windows XP laptop without a single reboot.  This is a marked improvement over the VS 2003 install.  So for 5Gb of HDD space what did I get?

  • .NET Framework 2.0
  • .NET Compact Framework 
  • SQL Server Mobile and Express Editions
  • Visual Studio for C#, VB, J# and C++
  • MSDN Full Install
  • MSXML 6.0
  • MSBuild
  • And stuff I simply don’t want to know about…

This is not really a bad trade.  Looking at some of the new directories on my machine, I think its time to delve a little deeper into MSBuild and Microsoft.NET.

 

 

Well not actually with Mike Cohn, but with Mike Cohn books!  Mike Cohn has been around a long time in the agile space, him being an agile alliance founder and all that jazz.  Anyway, enough about Mike and more about his books:

  • User Stories Applied: For Agile Software Development (2004)
  • Agile Estimating and Planning.

Let me start by saying that they are great books.  User Stories Applied is still relevant today but things have moved on a little since its gone to print but most of what he covers is excellent grounding for anyone new to user stories, as well as those requiring a refresher.  All you need is an ideal day to get through all the key points in the book. 

But Agile Estimating and Planning was really the prize winner for me.  When I started reading it, for the first few chapters where Mike explains why planning fails, I was laughing out loud.  Why? Because I had been on and ran projects that had failed for the reasons he clearly outlines in his book.  Damned I wish this book had been written 10 years ago!

Agile Estimating and Planning does not skirt around the issues but focusses on and provides good explanations, with numerous examples of how and why we should estimate and plan our projects.  Before this book, I had to battle to convince and/or demonstrate by example that the key is in planning and not the plan itself.  As Mike clearly points out, the plan is a snapshot of project progress.  How on earth can this be defined up front before a line of code has been cut and religously followed through to delivery, without continual refinement and change,  I just don’t know.  But people do it all the time.

Now I have the book to refer people to that clearly explains why we should change.  I no longer have to waste time trying to convert people.  Damned if only I had this book on a project that I fell into that the project manager, armed with Microsoft Project Plan, had tasks for every single class, I kid you not, within the system!  This was a big ole system.  You don’t want to think about the weekly status meetings we had on this global project…dull, dull, dull.  Hey Jim, you completed XmlInitParser.java.  Yep, that’s done.  How, about you Bob, you were 45% done on the RmiRetryStrategy.java?  Nah, had a registry problem.  Ten minutes later, a lot of dull implementation details, and finally, should be done tomorrow though.  Kill me now…how can you be 45% done on a class…?  It’s either done or not done!

Anyway, time for bed.  The books are great and well worth a read.  So go read them…

I was handed this book by Mr A after a night on the beers - it’ll make you more productive he said and scuttled off! Mr A, who wishes to remain anonymous and to never be associated with this book. Ever! That’s not because he didn’t find the book useful. No. But more that such books are cheesy, made for tv, which targets disorganised people aimlessly roaming the planet. He does not want to be placed in that bracket. Eh Mr A.

That said I think the book is more advanced common knowledge with a process for Getting Things Done! I incorporated parts of David Allen’s thinking into my working life and would recommend the book based just upon that fact only. Worth a casual flick through for a couple of hours…

Okay adam I thought I’d give this a go after your post because I too believe that editing within WordPress is pretty bad. After a painless install, the Windows Live Blog Post picked up everything, my categories, my blog, the works.

I know there are much better blog editors out there. I just don’t have the energy to find them. But if anyone has any suggestions I’m all ears. I’ll keep going with this one until something pops…