Creating the fixture

Information

The idea of a fixture isn't new.  It's an idea from the hardware world, the manufacture of microchips.  When a new chip is created it needs to be analysed and tested.  In order to do this the designers would create a special PCB onto which the new chip would be mounted.  The PCB would have several connectors from it, these connectors would be connected to test and analysis devices.  The PCB is known as a fixture.  It's basically an adapter that allows messages to be routed and translated to and from the chip to its test environment.

Google search "cpu test fixture" for images of this principle.

  1. Create a new project in your favourite IDE (it can be a maven project)
  2. Create a new class called Timesheet in the package "tdd_with_fitnesse"
  3. Define the class as follows
  4. Timesheet fixture
    package tdd_with_fitnesse;
    
    import java.text.NumberFormat;
    
    /**
     *
     * @author Selvyn
     */
    public class TimeSheet
    {
        public void setCheckInTime(String checkintime)
        {
        }
    
        public void setCheckOutTime(String checkouttime)
        {
        }
    
        public void setHourlyRate(String rate)
        {
        }
        
        public  String  CheckInTimeNormalized()
        {
    		return "";
        }
    
        public  String  CheckOutTimeNormalized()
        {
    		return "";
        }
    
        public String Pay()
        {
    		return "";
        }
    
        public  String  HoursWorked()
        {
    		return "";
        }
    
    
        //returns the number of hours worked
        public double calculateHoursWorked()
        {
        }
        
        public  void    execute()
        {
        } 
    }

    The execution order is as follows

    1. first all the setters are called in the order as they appear in the wiki
    2. then if an execute method is defined it is called (execute is optional)
    3. the get methods are called in the order as they appear in the wiki
  5. Compile and package the code into a jar (packaging is optional but makes deployment easier) into tdd_with_fitnesse_v2.jar, or point to the directory where the class files are.
  6. Go back to your FitNesse wiki page and run the test by pressing the "Test" button at the top right of the page.
  7. All the tests should fail.