【发布时间】:2018-11-29 02:26:27
【问题描述】:
我一直在尝试测试或弄清楚如何创建一个邮递员测试,该测试基本上会根据视频对象的返回次数通过/失败。
以下示例的响应仅包含 1 个视频对象(返回的还有很多)
{
"message": "OK",
"results": {
"videoList": [
{
"date": 1529005027860,
"reference": "00000163-daf7-d2a1-ad6f-faff8e490000",
"topicPath": "/data/sales-series/2013/art-of-the-automobile",
"brightcoveId": "5783291272001",
"image": {
"imagePathLarge": "http://qa2.sothebys.psdops.com/dims4/default/871ac2f/2147483647/resize/2000x2000%3E/quality/90/?url=https%3A%2F%2Fsothebys-brightspot-lower.s3.amazonaws.com%2F01%2F50%2F7a814bf44bf4b8fcbc0151540a74%2F34e50f06adc442efb9e2119d1d09a9f5%2Fposter.jpg",
"imagePathSmall": "http://qa2.sothebys.psdops.com/dims4/default/1ba20a8/2147483647/resize/250x250%3E/quality/90/?url=https%3A%2F%2Fsothebys-brightspot-lower.s3.amazonaws.com%2F01%2F50%2F7a814bf44bf4b8fcbc0151540a74%2F34e50f06adc442efb9e2119d1d09a9f5%2Fposter.jpg",
"alt": "[Geneva] Important Watches",
"imagePathMedium": "http://qa2.sothebys.psdops.com/dims4/default/4f630f7/2147483647/resize/600x600%3E/quality/90/?url=https%3A%2F%2Fsothebys-brightspot-lower.s3.amazonaws.com%2F01%2F50%2F7a814bf44bf4b8fcbc0151540a74%2F34e50f06adc442efb9e2119d1d09a9f5%2Fposter.jpg",
"fileReference": "00000164-19c9-da7f-af6f-ddd9a6650000"
},
"dateDisplay": "2018-06-14T15:37:07.860-0400",
"sortOrder": 1529005027860,
"topic": "Art of the Automobile",
"text": "description value in the description field ",
"title": "[Geneva] Important Watches",
"objectType": "VIDEO"
},
]
},
"errors": [],
"statusCode": 200
我创建了一个无论我输入哪个值都通过的邮递员测试,因此如果响应返回 3 个视频,则以下测试仍然通过,请帮助!:
var response = JSON.parse(responseBody);
var video = response.results.videoList[0]
//Testing Video Count
tests["5 video objects returned"] = response.results.videoList.length = 5;
【问题讨论】:
-
以正确的格式添加 json
标签: javascript api testing postman qa