...
- Create a new project in your favourite IDE (it can be a maven project)
- Create a new class called Timesheet in the package "tdd_with_fitnesse"
- Define the class as follows
Code Block language java title Timesheet fixture linenumbers true 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
- first all the setters are called in the order as they appear in the wiki
- then if an execute method is defined it is called (execute is optional)
- the get methods are called in the order as they appear in the wiki
- compile 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.
- Go back to your FitNesse wiki page and run the test by pressing the "Test" button at the top right of the page.
- All the tests should fail.