Thursday, January 21, 2010

Troubleshooting with fitSharp and FitNesse

To use fitSharp with FitNesse, we set the FitNesse TEST_RUNNER variable.
!define TEST_RUNNER {c:\program files\fitSharp\Runner.exe}
For troubleshooting and debugging, there is an alternate test runner we can use.
!define TEST_RUNNER {c:\program files\fitSharp\RunnerW.exe}
This runner pops up a window before it starts executing tests.




 At this point, we can attach our debugger to the RunnerW process. When we click 'Go', the tests are executed. If an unhandled exception occurs, we'll see it in the window.



When we're finished, we click 'Go' again to finish the test.


Monday, January 4, 2010

Accessing the System Under Test with fitSharp

FitNesse Java Slim has a new feature in the latest release for directly accessing methods on the system under test. fitSharp has had an equivalent feature for a while, courtesy of the old FitLibrary .NET code base. We simply implement the DomainAdapter interface on our Slim fixture.

using fitSharp.Machine.Model; namespace fitSharp.Samples { public class SampleSlimFixture : DomainAdapter { private readonly SampleDomain systemUnderTest = new SampleDomain(); public object SystemUnderTest { get { return systemUnderTest; } } public void SomeFixtureMethod() {...} } public class SampleDomain { public void SomeMethod() {...} } }
Now we can invoke methods on the fixture and the SUT class from a Slim table.

|script|SampleSlimFixture|
|SomeFixtureMethod|
|SomeMethod|