Fitnesse JSON 期望语法
Fitnesse JSON expectation syntax
参考workflow of creating tests using RestFixture,我在问自己,下面的语句代表什么样的语法:
jsonbody.name === 'Ted'
我需要知道这种语法的所有可能性,才能写下更复杂的 JSON 响应的预期值。
此处使用的语法类型是否有名称或参考?
语法是Javascript语法。 jsonbody
是包含响应的变量。
有关详细信息,请参阅 JavascriptExpectations in RestFixtureLiveDoc。例如:
As of RestFixture Version 2, a javascript engine is embedded to allow expectations in Javascript on response body contents in JSON format.
!**** XPaths and JSON
For backward compatibility XPath expressions are maintained and executed
****!
After a successful response is received with content type "application/json" the expectation cell in a .RestFixture row is
interpreted as a string with Javascript and executed within the context of the response body.
一个例子:
| Table: Rest Fixture |http://${jettyHost}:${jettyPort}|
|GET | /resources/%id%.json | 200 |Content-Type : application/json |!-
jsonbody.resource.name=="test post" && jsonbody.resource.data=="some data"
-!|
参考workflow of creating tests using RestFixture,我在问自己,下面的语句代表什么样的语法:
jsonbody.name === 'Ted'
我需要知道这种语法的所有可能性,才能写下更复杂的 JSON 响应的预期值。 此处使用的语法类型是否有名称或参考?
语法是Javascript语法。 jsonbody
是包含响应的变量。
有关详细信息,请参阅 JavascriptExpectations in RestFixtureLiveDoc。例如:
As of RestFixture Version 2, a javascript engine is embedded to allow expectations in Javascript on response body contents in JSON format.
!**** XPaths and JSON
For backward compatibility XPath expressions are maintained and executed
****!After a successful response is received with content type "application/json" the expectation cell in a .RestFixture row is interpreted as a string with Javascript and executed within the context of the response body.
一个例子:
| Table: Rest Fixture |http://${jettyHost}:${jettyPort}| |GET | /resources/%id%.json | 200 |Content-Type : application/json |!- jsonbody.resource.name=="test post" && jsonbody.resource.data=="some data" -!|