LoginSignup
1
1

More than 5 years have passed since last update.

FitNesse を C# で使う時のメモ

Posted at

http://fitnesse.org/ から fitnesse-standalone.jar を持ってくる。
plugin のリンクから fitsharp の欲しいのを持ってくる。

こんな風にフォルダを構成して

C:\fitnesse
C:\fitnesse\fitnesse-standalone.jar
C:\fitnesse\fitsharp\release.2.2.net.35
C:\fitnesse\fitsharp\release.2.2.net.40

C:\fitnesse\fitnessestandalonestart.bat

fitnessestandalonestart.bat
java -jar fitnesse-standalone.jar -p 8080

などとして起動する。

http://localhost:8080/ にアクセスして Wiki を記述する。

!contents -R2 -g -p -f -h

!define TEST_SYSTEM {slim}

!path C:\Targets\SampleFitnesse.dll
!define COMMAND_PATTERN {%m -r fitSharp.Slim.Service.Runner %p}
!define TEST_RUNNER {fitsharp\release.2.2.net.40\Runner.exe}
!define PATH_SEPARATOR {;}

!|import|
|Top.Second.Third.SampleFitnesse|


!1 値を設定したら出力が得られる。
!|ClassUnderTest|
| Foo | Bar | Result? |
|   1 |   1 |       1 |
|  12 |   3 |       4 |

!1 値を設定したら出力が得られる。
!|Script|ClassUnderScriptTest|
| check | Foo |  1 | Bar | 1 | 1 |
| check | Foo | 12 | Bar | 3 | 4 |

Wiki ページのプロパティーを
Tool > Properties とたどり property を Testに変更して save propertiesをクリックする。
するとテストボタンが現れる。

動かしてみるサンプルコードを作る。

namespace Top.Second.Third.SampleFitnesse
{
    public class ClassUnderTest
    {
        public int Foo { set; get; }
        public int Bar { set; get; }

        public string Result()
        {
            int r = Foo/Bar;
            return r.ToString();
        }
    }

    public class ClassUnderScriptTest
    {
        public string FooBar(int lhs, int rhs)
        {
            int r = lhs/rhs;
            return r.ToString();
        }
    }
}

これを SampleFitnesse.dll となるようにビルドして C:\Targets\ の下へ置く。

testボタンをクリックする。

結果

result.png

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1