开发者

step by step tutorial for using slim fitnesse in .net

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开发者_StackOverflow's next


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

    • http://schuchert.wikispaces.com/Acceptance+Testing.UsingSlimDotNetInFitNesse


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜