Search code examples
c#fitnessefitsharp

Need simple example of FitNesse SetUpFixture under .NET


I've been trying to implement FitNesse tests for our C# application. I'm using the latest FitNesse jar and the fitSharp .NET 2.2 4.0 libraries.

I have been able to successfully use scenarios using Slim. However, in the interests of making tests that are more legible to a non-technical audience, I'm interested in implementing DoFixtures, and I surmise I'll need SetUpFixtures to create common data conditions for tests.

I can't seem to get the data I set up into the DoFixture instance, though. I've looked at several resources (Gojko's book chief among them), but none seem to talk about this concept in isolation. Attaching Visual Studio as a debugger to test runs hasn't yielded any insight. I could really use a trivial example to analyze and build upon.

Would someone be willing to share an example that includes just:

  • A SetUpFixture class that sets up some data
  • A DoFixture class that uses the data from the SetUpFixture
  • Wiki syntax to invoke them?

Solution

  • Looks like SetUp was not called. Use Debugger.Launch() for debug

    Update:

    !|BirdCall|
    |birdName|noise|
    |duck|quack|
    
    public class SkylarkBunting : fitlibrary.DoFixture
    {
        public BirdCall BirdCall;
    
        public SkylarkBunting(BirdCall birdCall)
        {
            BirdCall = birdCall;
        }
    
        public string GetCall()
        {
            return BirdCall.Noise;
        }
    
        public string GetName()
        {
            return BirdCall.BirdName;
        }
    }