English 中文(简体)
在.net中使用修身的分步教程
原标题:step by step tutorial for using slim fitnesse in .net

有人知道在.net中使用修身的分步教程吗?

现在,我设法在我的localhost:3434上运行了纤薄的fitnesse网站

我在c:\fitSharp中解压缩了fitSharp插件

但我不知道接下来会发生什么

最佳回答
问题回答

FitNesse是一个wiki,包含可以执行以执行系统测试的表。然后,表会告诉FitNesse创建一些类,对它们进行一些操作,并检查结果。

例如,为了使用.NET,您只需要告诉FitNesse如何与.NET链接以及要加载哪些.NET程序集。没有别的。.NET项目可以是一个完全不了解FitNesse的简单类库。

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:fitfitSharp elease.1.9.net.35)

  2. 从命令行启动FitNesse:

    java -jar fitnesse.jar -p 8080
    
  3. 创建并编译C#类库项目,使用:

    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. 浏览到http://localhost:8080/然后单击标题旁边的[添加子项]并添加测试页面。

  5. 键入wiki页面内容,如下所示(更新路径):

    !define TEST_SYSTEM {slim}
    !define COMMAND_PATTERN {%m -r fitSharp.Slim.Service.Runner,D:fitfitSharp
    elease.1.9.net.35fitsharp.dll %p}
    !define TEST_RUNNER {D:fitfitSharp
    elease.1.9.net.35Runner.exe}
    
    !path D:fitMyFixtureClassLibrary1inDebugClassLibrary1.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      |
    

    注意!在之前|import|是为了避免ClassLibrary1被视为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





相关问题
Manually implementing high performance algorithms in .NET

As a learning experience I recently tried implementing Quicksort with 3 way partitioning in C#. Apart from needing to add an extra range check on the left/right variables before the recursive call, ...

Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How do I compare two decimals to 10 decimal places?

I m using decimal type (.net), and I want to see if two numbers are equal. But I only want to be accurate to 10 decimal places. For example take these three numbers. I want them all to be equal. 0....

Exception practices when creating a SynchronizationContext?

I m creating an STA version of the SynchronizationContext for use in Windows Workflow 4.0. I m wondering what to do about exceptions when Post-ing callbacks. The SynchronizationContext can be used ...

Show running instance in single instance application

I am building an application with C#. I managed to turn this into a single instance application by checking if the same process is already running. Process[] pname = Process.GetProcessesByName("...

How to combine DataTrigger and EventTrigger?

NOTE I have asked the related question (with an accepted answer): How to combine DataTrigger and Trigger? I think I need to combine an EventTrigger and a DataTrigger to achieve what I m after: when ...

热门标签