我不知道你提到的灯具,但你可以用我的灯具做你描述的事情(https://github.com/fhoeben/hsac-fitnesse-fixtures)。
对于字符串:nl.hsac.fitnesse.fixture.slim.StringFixture
|script|string fixture |
|check |value of |Hello |Hello |
|check |length of |Hello |5 |
|ensure|text |Hello world! |contains |world |
|reject|text |Hello world! |contains |moon |
|ensure|value |Hello |differs from|Hell |
|ensure|value |Hello |equals |Hello |
|check |convert to upper case|Bye |BYE |
|check |convert to lower case|Bye |bye |
|check |normalize whitespace |!- Hello World -! |Hello World |
|check |replace all |Hello ([A-Za-z]+) |in |Hello World|with|$1 |World |
|check |replace all |(\d{4})-(\d{1,2})-(\d{1,2})|in |1975-12-3 |with|$3-$2-$1|3-12-1975|
对于 JSON(使用JsonPath): nl.hsac.fitnesse.fixture.slim.JsonHttpTest
|script |json http test |
|get from|http://echo.jsontest.com/key/value/one/two|
|show |response |
|check |json path |$.key |value |
|check |json path |$.one |two |
因此,您的 REST 检查将类似于:
|script |json http test |
|get from|http://localhost/data/1234 |
|show |response |
|check |json path |$.Data[0].Id |1|
|note |or assign to symbols |
|$body= |response |
|$id= |json path |$.Data[0].Id |