Sunday, November 8, 2009

GivWenZen and FitLibrary

My previous examples of using GivWenZen to write BDD style tests with FitNesse were done with the SLiM test system.  This was mostly due to an issue getting FitLibrary to run with the latest version of FitNesse.  However, Rick Mugridge has released a new version that fixes this issue as well as a few other nice enhancements.  Fixing of autowrapping of booleans, Strings, and other native java types was also big benefit to helping the BDD test read better.


Using GivWenZen with FitLibrary is very easy.  Create your own fixture that extends DoFixture, or any of the related type fixtures, and set the system under test to your instance of the GivWenZenExecutor.  The following is a simple example with a DoFixture extension.


import fitlibrary.DoFixture;

public class GivWenZenDoFixture extends DoFixture {

    public GivWenZenDoFixture() {
        super(new GivWenZenExecutor());
    }
}




This will allow you to have a FitLibrary specification/test like the following:

!|GivWenZenDoFixture|

|given|i turn on the calculator| 
|and|i have entered 50 into the calculator| 
|and|i have entered 75 into the calculator | 
|when|i press add| |then|the total is 125|


I am looking at enhancing this using the FitLibrary pluggability to change how methods are looked up. Hopefully, I will have a new post on this soon.


Thanks for the FitLibrary update Rick!

No comments:

Post a Comment