anybody knows some step by step tutorial for using slim fitnesse in .net ?
for now I managed to run the slim fitnesse website on my localhost:3434
and I unziped the fitSharp plugin in c:/fitSharp
but I have no idea what's next
To open FitNesse, open your browser and type: http://localhost:<portnumber>. In this case, the port number is 2222. So here, if you can see the Tests dropdown, we can create a “Suite page” as well as a “Test Page”. When you create a suite, all the test scripts within that suite will be executed.
If you want a test page to be run under SLIM, you simply set the TEST_SYSTEM variable to "slim" instead of "fit". If this variable is set on your page, (as it is on this page!) or on any parent page, then your page will be run with Slim.
Slim (Simple List Invocation Method) is an alternative to Fit. Rather than running all the HTML processing, comparisons, and colorizing in the System Under Test (SUT), Slim keeps all that behavior on in FitNesse.
FitNesse is a wiki with tables that can be executed to do system testing. Tables will then tell FitNesse to create some classes, do some operations on them, and check the result.
In order to work with .NET for example, you simply need to tell FitNesse how to link with .NET and which .NET assemblies to load. Nothing else. The .NET project can be a simple class library with no knowledge of FitNesse at all.
Download FitNesse and fitSharp
(in this example fitSharp has been extracted to D:\fit\fitSharp\release.1.9.net.35\
)
Start FitNesse from the command-line:
java -jar fitnesse.jar -p 8080
Create and compile a C# Class Library project with:
namespace ClassLibrary1
{
public class ShouldIBuyMilk
{
private int _cash;
private int _pintsOfMilkRemaining;
private string _useCreditCard;
public void SetCashInWallet(int cash)
{
_cash = cash;
}
public void SetCreditCard(string useCreditCard)
{
_useCreditCard = useCreditCard;
}
public void SetPintsOfMilkRemaining(int pints)
{
_pintsOfMilkRemaining = pints;
}
public string GoToStore()
{
if (_cash > 0 || _useCreditCard.Equals("yes"))
return "yes";
return "no";
}
}
}
Browse to http://localhost:8080/ then click '[add child]' next to the title and add a 'Test' page.
Type in the wiki page content like below (update the paths):
!define TEST_SYSTEM {slim}
!define COMMAND_PATTERN {%m -r fitSharp.Slim.Service.Runner,D:\fit\fitSharp\release.1.9.net.35\fitsharp.dll %p}
!define TEST_RUNNER {D:\fit\fitSharp\release.1.9.net.35\Runner.exe}
!path D:\fit\MyFixture\ClassLibrary1\bin\Debug\ClassLibrary1.dll
!|import|
|ClassLibrary1|
|Should I buy milk|
|cash in wallet|credit card|pints of milk remaining|go to store?|
| 0 | no | 0 | no |
| 10 | no | 0 | yes |
| 0 | yes | 0 | yes |
| 10 | yes | 0 | yes |
| 0 | no | 1 | no |
Note the '!' before !|import|
is to avoid 'ClassLibrary1' to be seen as a wikiword.
Save it, and click "Test" in the left menu. FitNesse will load the assembly, create an instance of your class, set some properties by following the naming convention mapping, and finally check some properties.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With