Sunday, March 19, 2006

Learning Fitnesse Today

What a great-looking tool Fitnesse is for wrapping your customers into the entire development process! I think it’s also got some interesting promise for difficult combinatorial testing scenarios.  I've been plunking away at Fitnesse part of last night and this morning and finally got something working just now.

Several things weren't readily apparent on getting it going in the .NET environment. First off, you'll need to grab the source and compile the FitServer project for the 2.0 Framework if you're using that environment. I also ended up rebuilding the fit library project just to be sure.  (“System.ApplicationException” errors stating your test fixture assembly couldn’t be found are the result of trying the 1.1–compiled server on 2.0 assemblies.)

Secondly, and this one's a head-slapper, you don't need to start the dotnet\FitServer executable separately. I spent 30 minutes or so Googling the heck out of things before finally realizing the answer was staring me right in the face on the DotNetFitServer Wiki page. Duh. Just fire off the run.bat file in the fitnesse root, add the lines noted on the DotNetFitServer line, create your tests and fixtures. FitNesse's goodness spawns the FitServer all on its own.

One last issue: set the “Copy Local” property of the fit.dll reference to “False.”  Otherwise you’ll get odd messages about “Couldn’t cast XYZ.ABC to Fixture.  Did you remember to extend Fixture?”  (Thanks to Heinrich for the answer on that one.)

FWIW, here’s my first table:

!|JHSCR.FitFixtures.HourlyWagesFixture| |hours|rate|Wages?| |20 | 33.22| 664.40| 

 and the corresponding fixture:

namespace JHSCR.FitFixtures


    public class HourlyWagesFixture : fit.ColumnFixture


        public double hours;

        public double rate;

        public double Wages()


            IEmployee emp = TestFactory.CreateDefaultPerson();

            emp.WageType = Employee.WageTypes.HOURLY;

            emp.HourlyRate = rate;


            Payroll pay = new Payroll();

            return pay.ComputeWages(emp, hours);




Note that you can use namespaces, you’ve just got to use them in both the test fixture code and the test table itself. 

(Yes, it was green!)


UPDATE: Fixed the busted formatting on the test table.  Sorry.

No comments:

Subscribe (RSS)

The Leadership Journey