I use to use cory foy's example, but it's a bit dated now.
Step 1:
Download fitnesse
http://fitnesse.org/FrontPage.FitNesseDevelopment.DownLoad
click the fitnesse.jar link
extract it to c:\fitnesse
run java –jar fitnesse.jar –p [port]
(If you want port 80 then leave off the –p and port)
Navigate to http://localhost/ to try it out or http://localhost:[port]
Step 2:
Get fitsharp so you have the dlls for making fixtures and slim runner
go to: http://github.com/jediwhale/fitsharp/downloads
extract it to c:\fitnesse\slim
Step 3:
Make your test fixtures class library in visual studio
Step 4:
reference the fit and fitsharp dlls from c:\fitnesse\slim
and reference any of your “System under test” dlls. (your dlls that your system uses that you want to test)
Step 5:
Write a fixture
using fit;
namespace Fitnesse
{
public class CalculateDiscount : ColumnFixture
{
}
}
Step 6:
Make your first wiki page.
Such as editing the front page and adding MyFirstFitnessePage
It will show up like this after you save it:
MyFirstFitnessePage?
Click on the ‘?’ to create it.
Step 7: make it a test page
go to properties and change it to a “test” page.
Step 8: Add all this stuff to the top of it
!define TEST_SYSTEM {slim}
!define COMMAND_PATTERN {%m -r
fitSharp.Slim.Service.Runner,C:\Fitnesse\slim\fitsharp.dll %p}
!define TEST_RUNNER {C:\Fitnesse\slim\Runner.exe}
!path C:\projects\Fitnesse\Fitnesse\bin\Debug\Fitnesse.dll
(the last line should be a direct path to your fixtures dll)
Step 9:
Make a test table
|!-Fitnesse.CalculateDiscount-!|
|amount |discount? |
|0 |0 |
|100 |0 |
|999 |0 |
|1000 |0 |
|1010 |50.5 |
|1100 |55 |
|1200 |60 |
|2000 |1000 |
the !- -! Syntax forces literal text so it won’t interpret “CalculateDiscount” as a wiki page link you’ll get an error like this if you don’t do it
Could not find class CalculateDiscountATitleCreatePageHrefCalculateDiscountEditNonExistentTrueA
Apparently “ATitleCreatePageHrefCalculateDiscountEditNonExistentTrueA” gets appended when the ? is next to it.