请参阅下面的代码,它没有执行。我在这里缺少什么?
start slim
!path C:\Fitnesse\RestFixture\lib\*.jar
!path C:\Fitnesse\RestFixture\lib\smartrics-RestFixture-3.0.jar
!define expectedReturnHeaders {Content-Length : [\d]+
Content-Type : application/json }
|!-Table:smartrics.rest.fitnesse.fixture.RestFixture-! | https://www.googleapis.com/books/v1/volumes?q=isbn:0735619670|
|GET| Content-Type : application/json |jsonbody.items[0].id=="QnghAQAAIAAJ"
我收到错误
jsonbody.items.id=="QnghAQAAIAAJ"
java.lang.IllegalArgumentException: Cannot evaluate 'jsonbody.items.id=="QnghAQAAIAAJ"' in {
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Required parameter: q",
"locationType": "parameter",
"location": "q"
}
],
"code": 400,
"message": "Required parameter: q"
}
}
答案 0 :(得分:0)
示例代码
|!- Table:smartrics.rest.fitnesse.fixture.RestFixture-!|http://maps.googleapis.com/maps/api/geocode/json|
|setHeader |!-Accept: application/json-! |
|GET |?address=1600+Amphitheatre+Parkway |200 | |!-/* javascript */
result = false;
var addr = jsonbody.results[0].address_components;
for (i in addr) {
if (addr[i].types[0]==='route') {
if (addr[i].long_name==='Amphitheatre Parkway') {
result = true;
}
}
}
result;
-!|