!3 !c This tutorial describes the ColumnFixture element of the [[FIT][http://fit.c2.com]] framework.  It is composed of the following sections:
|!-fit.Fixture-!|
|ColumnFixture|''This page.  Describes the basic functions of the fixture''|
|ColumnFixtureDesign|''Describes tips and philosophy of designing ColumnFixture tests.''|
----
!2 !c Basic Functionality of ColumnFixture
A column fixture is about a simple as a test fixture can be.  It is the equivalent of calling a function in a programming language.  The table specifies the input arguments to the function, and the return values from the function.

Here's a simple example (see it work by hitting the '''Test''' button or typing ''ALT-t''.):

|eg.Division|
|numerator|denominator|quotient?|
|100|4|25|
|100|4|>26|
|300|3|100|
|700|4|_>100|
|28|5|5<_<6|
|22|10|2 <= _ < 3|
|300|X|24|
|1|0|error|

The Division fixture is written like this:{{{
package eg;

// Copyright (c) 2002 Cunningham & Cunningham, Inc.
// Released under the terms of the GNU General Public License version 2 or later.

import fit.ColumnFixture;

public class Division extends ColumnFixture {
    public float numerator;
    public float denominator;
    public float quotient() {
        return numerator / denominator;
    }
}
}}}It should be obvious how this works.  The header row of the table specifies the inputs and outputs of the fixture.  The '''numerator''' and '''denominator''' headers specify the inputs to the '''Division''' fixture.  The '''quotient?''' header specifies an output.   Fit translates the inputs to fields of the fixture, and the outputs to methods.  For each row of the table, the cells are processed left to right.  The contents of input cells are stored in the fields of the fixture.  For each output cell the return value of the method is compared to the contents of the cell.  If the return value of the method matches the corresponding table cell, then the cell is turned green.  Otherwise it it turned red, and the expected and actual values are shown.

Comparison expressions can also be used in numeric output cells.  In these expression the underscore character represents the return value of the method.  You can use standard inequalities.  
 * For example: 
  * '''_ < 32''' or 
  * '''_ >= 99'''.  
 * You can also use a range such as:
  * '''38 <= _ <55'''.  
 * For simple expressions the underscore can be omitted, thus: 
  * '''<99''' is legal.

There are two special functions that you can override when you write a !-ColumnFixture-!
 * ''reset()'' will be called at the beginning of each row.
 * ''execute()'' will be called just prior to processing the first ''()'' or ''?'' cell in each row, or after the last cell in the row has been processed, whichever comes first.

You can use these two functions to treat each row as a transaction.  ''reset()'' can clear all the variables and get ready for the next transaction.  ''execute()'' can do the transaction processing.  

!img http://files/images/runArrow.gif For more on ColumnFixture see: ColumnFixtureDesign.
