Geeks With Blogs

News
Shelfari: Book reviews on your book blog

.net alternatives by Michel Grootjans

 

In our new project, we've decided to use FitNesse with slilm. All in all, slim is an improvement over fit.

The thing I like most is the error messages when running tests. These are now much clearer than with fit.

The fixtures are now plain old objects (that's poo -- you can call them pojo, poco or even pono for all I care). So no dependency anymore on fit.

Slim is also supposed to run faster, but right now our project is not really big enough to notice the difference.

There's two things I don't like about slim.

First, when writing scripts (the old DoFixture) or queries (the old RowFixture), you have to tell that to the wiki by prefixing the table with the corresponding keyword (|script| or |query|). This adds a technical touch to a wiki page that should be customer facing. I like to think about the wiki pages as requirements that are being elaborated by examples and scenario's. These keywords are technical cruft that get in the way of getting the functional message across. There's a little trick to hide the first row of each table however. Just add a # in front of the row, and all these technical details are gone.

The second thing I don't like bothers me more. The query fixture is now harder to implement than the previous RowFixture. In fit, you could return a list of any arbitrary objects, the column names would magically match any property or field for the items in the list. Now you have to do that work yourself by providing a list of objects. Each item then has to hold a list of properties, which in turn are lists of two items: column name and string value.

After looking around, my co-presenter Pascal found an alternative that uses reflection. This is the API to use this utility.

var people = ...//get the list of results for the queryList<object> results = new List<object>();
foreach (var person in people)
{
    results.Add(AddObjectToQueryResult(person));
}
return results;

Being the geek that I am, I couldn't resist the urge to try to improve this. I ended up with something like this: 

var people = ...//get the list of results for the queryList<object> results = new List<object>();
return people.CreateRowFixture()
    .AddColumn("FullName", dto => dto.FirstName + " " + dto.LastName)
    .ToList();

Here is a link to the full code with tests on google code.

Posted on Sunday, January 31, 2010 5:05 PM .net , FitNesse | Back to top


Comments on this post: Learning to use slim instead of fit to run FitNesse

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Michel Grootjans | Powered by: GeeksWithBlogs.net