step by step tutorial for using slim fitnesse in .net
Asked Answered
S

2

7

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

Selfmastery answered 2/6, 2011 at 13:1 Comment(1)
@Chris S you're joking right ? :)Selfmastery
L
6

in your case this will be useful: http://fitsharp.github.com/Slim/GettingStarted.html

else you should consider: http://schuchert.wikispaces.com/Acceptance+Testing.UsingSlimDotNetInFitNesse

Logbook answered 2/6, 2011 at 13:19 Comment(0)
L
10

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.

Requires tools

  • FitNesse - The Java-based FitNesse wiki and testing framework.
  • fitSharp - Contains .NET libraries to write FIT and SliM fixtures.

Sample steps

  1. Download FitNesse and fitSharp (in this example fitSharp has been extracted to D:\fit\fitSharp\release.1.9.net.35\)

  2. Start FitNesse from the command-line:

    java -jar fitnesse.jar -p 8080
    
  3. 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";
            }
        }
    }
    
  4. Browse to http://localhost:8080/ then click '[add child]' next to the title and add a 'Test' page.

  5. 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.

  6. 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.

    See also

Lophobranch answered 3/10, 2011 at 10:45 Comment(1)
Can I package my test fixtures as an .exe instead of a .dll and have Fitnesse call it?Kentkenta
L
6

in your case this will be useful: http://fitsharp.github.com/Slim/GettingStarted.html

else you should consider: http://schuchert.wikispaces.com/Acceptance+Testing.UsingSlimDotNetInFitNesse

Logbook answered 2/6, 2011 at 13:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.