Saturday, September 18, 2004

An alternate to MbUnit's CurrentFixture

Now that my library of MbUnit unit tests is growing it's becoming a non-trivial amount of time to run them, something that I'd rather avoid when doing a very tight red/green/refactor loop.

To speed things up I've been using the CurrentFixture attribute like so:

[CurrentFixture]

[Test]
public void DoSomeTest()
{
...
and the associated property of the AutoRunner in main:
public static void Main (string[] args)

{
using (AutoRunner auto = new AutoRunner ())
{
auto.Domain.Filter = FixtureFilters.Current;
...

The issue is, I keep having to check out my previous test fixture to remove the attribute so I can worry only about my current fixture. That leads to a lot of comments like "Removed CurrentFixture attribute" in my version control.

Here's what I now do. I don't use CurrentFixture at all. Instead I have the following in main:
public static void Main (string[] args)

{
using (AutoRunner auto = new AutoRunner ())
{
auto.Domain.Filter
= FixtureFilters.Type ("My.Full.Class");
...

Now I only need to check out the main line (or more often just keep it checked out) to work on another fixture.

[Listening to: Stone Temple Pilots - Trippin' on a Hole in a Paper Heart]

No comments: