Introduction

FitNesse is an opensource product that promotes BDD (Behaviour Driven Development).
MinuteProject generates fixtures for CRUD operations on top of the database.

MinuteProject 4 FitNesse

MinuteProject 4 FitNesse generates the following FitNesse Artifacts
  • A wiki (wiki snippet + associated fixtures) for
    • CUD features against the database tables;
    • Select features against the database entities (tables/views)

Run

The delivery is shipped with a demonstration:
In sample: start-petshop-database.bat
In demo/config : demo-fitnesse.cmd (do not forget to be in java 1.6)

For the user's specific model follow the Tutorial
  • to configure your model specificities (connection);
  • and adapt your target to point to mp-template-config-fitnesse.xml (same target configuration as in /demo/config/mp-config-fitnesse.xml).

The rest of the page deals with the generation coming from the demo.

Generation

  • in demo/output/petshopFitnesse/src-generated:
    • FitNesse column fixture for performing SELECT action. One for each table;
    • FitNesse column fixture for performing INSERT UPDATE DELETE action. One for each table;
  • in demo/output/petshopFitnesse/TestFitNesse: a FitNesse wiki structure compliant artifact ready to copy in FitNesse main directory
    • FitNesse wiki page 'content.txt'. One for the model in the root directory.
    • FitNesse wiki page 'content.txt'. One for the model in the root directory. Holds the information for the DB connection.
    • FitNesse wiki page 'content.txt'. One for each entity (table/view) in the root directory.This snippet matches the generated fixture.
    • Example for the PRODUCT table
      !|sf.net.mp.demo.petshop.fitnesse.fixture.pet.ProductTableFixture|
      |General Info Input|table|PRODUCT|count|3|
      |Fields |  PRODUCTID |   CATEGORYID |   NAME |   DESCRIPTION |   IMAGEURL | 
      |Expression | |  |  |  |  |  
      |Value | |  |  |  |  | 
      |Order | |  |  |  |  | 
      |general Info Output|numberOfRow|3| 
      |row#1 | |  |  |  |  | 
      |row#2 | |  |  |  |  | 
      |row#3 | |  |  |  |  | 
Remark in version 0.4.3 Expression contains |Expression | null | null | null | null | null | , the 'null' can be replaced by blank. (done in next release).
  • in demo/output/petshopFitnesse/TestFitNesseCrud: a FitNesse wiki structure compliant artifact ready to copy in FitNesse main directory
    • FitNesse wiki page 'content.txt'. One for the model in the root directory.
    • FitNesse wiki page 'content.txt'. One for the model in the root directory. Holds the information for the DB connection.
    • FitNesse wiki page 'content.txt'. One for each entity in the root directory.This snippet matches the generated fixture to perform INSERT/UPDATE/DELETE operation.
    • Example for the ADDRESS table
    • !3 Insert into ADDRESS snippet
      !|sf.net.mp.demo.petshop.fitnesse.fixture.crud.pet.AddressColumnFixture|
      |  ADDRESSID *|   STREET1 *|   STREET2 |   CITY *|   STATE *|   ZIP *|   LATITUDE *|   LONGITUDE *|  insert? |
      | |  |  |  |  |  |  |  |  OK |
      !3 Update into ADDRESS snippet
      !|sf.net.mp.demo.petshop.fitnesse.fixture.crud.pet.AddressColumnFixture|
      |  ADDRESSID |    STREET1 |    STREET2 |    CITY |    STATE |    ZIP |    LATITUDE |    LONGITUDE |     WHERE_ADDRESSID |   WHERE_STREET1 |   WHERE_STREET2 |   WHERE_CITY |   WHERE_STATE |   WHERE_ZIP |   WHERE_LATITUDE |   WHERE_LONGITUDE |  update? |
      | |   |   |   |   |   |   |   |    |  |  |  |  |  |  |  |  OK |
      !3 Delete from ADDRESS snippet
      !|sf.net.mp.demo.petshop.fitnesse.fixture.crud.pet.AddressColumnFixture|
      |  ADDRESSID |    STREET1 |    STREET2 |    CITY |    STATE |    ZIP |    LATITUDE |    LONGITUDE |     WHERE_ADDRESSID |   WHERE_STREET1 |   WHERE_STREET2 |   WHERE_CITY |   WHERE_STATE |   WHERE_ZIP |   WHERE_LATITUDE |   WHERE_LONGITUDE |  delete? |
      | |   |   |   |   |   |   |   |    |  |  |  |  |  |  |  |  OK |

Dependencies

FitNesse java classes are dependent on:
  • fitnesse.jar
  • fitlibrary.jar
  • mp-fitnesse.x.y.z.jar (shipped in /target/fitnesse).

Packaging

  1. Compile the generated code with the previous dependencies;
  2. Add reference in the FitNesse wiki page ('!path ...');
  3. copy demo/output/petshopFitnesse/TestFitNesse and demo/output/petshopFitnesse/TestFitNesseCrud into FitNesse wiki /FitNesseRoot

Test

Check at http://localhost/TestFitNesse for Select operations.
Check at http://localhost/TestFitNesseCrud for Insert/update/delete operations.

Usage

Copy the desired snippet to write/verify (integrity check point) your stories. (do not correct to add the DB connection fixture).
Ex:
Perform a UC via a hand-made fixtures;
Eventually perform an integrity/sanity check to verify that the data are correct.
Tip: use DB views!! Views can cross check information between multiple tables/views and the user can check very manipulation is correctly done in the Database.


TODO sample Petshop FitNesse page.

Improvements

Add setUp fixture to clean the database.