我正在使用邮递员客户端,并试图从csv文件读取数据。作为一个PoC,我在端点下面使用了url
8月份的https://www.googleapis.com/books/v1/volumes?q=Light
下面是我的代码
tests["Status code is 200"] = responseCode.code === 200;
postman.setEnvironmentVariable("requestBook", data.requestBook);
var response = JSON.parse(responseBody);
tests["Validate the title is correctly populated"] = /{{title}}/.test(response.items[0].volumeInfo.title);
tests["Validate the author is correctly populated"] = /{{authors}}/.test(response.items[0].volumeInfo.authors);
tests["Validate the publisher is correctly populated"] = /{{publisher}}/.test(response.items[0].volumeInfo.publisher);
tests["Validate the published date is correctly populated"] = /{{publishedDate}}/.test(response.items[0].volumeInfo.publishedDate);
tests["Validate the page count is correctly populated"] = /{{pageCount}}/.test(response.items[0].volumeInfo.pageCount);
tests["Validate the category is correctly populated"] = /{{categories}}/.test(response.items[0].volumeInfo.categories);
tests["Validate the amount is correctly populated"] = /{{amount}}/.test(response.items[0].saleInfo.listPrice.amount);
tests["Validate the currency code is correctly populated"] = /{{currencyCode}}/.test(response.items[0].saleInfo.listPrice.currencyCode);
它正在失败。当我检查我的csv文件时,它看起来都很好。
注意:当我单击预览时,我的所有数据都会以双引号显示。
发布于 2017-05-16 06:32:10
我找到了解决办法,因此解决了这个问题。新代码是测试“验证标题正确填充”= response.items.volumeInfo.title === data.title;
https://stackoverflow.com/questions/43968078
复制相似问题