如何解决在 Postman 上测试 JSON 中的大型响应
[
{
"key": "Dateline Standard Time","value": "(UTC-12:00) International Date Line West"
},{
"key": "UTC-11","value": "(UTC-11:00) Coordinated Universal Time-11"
},{
"key": "Aleutian Standard Time","value": "(UTC-10:00) Aleutian Islands"
}]
那么,在“测试”选项卡内,我应该写什么来测试响应是否完全相同?
我尝试过这样的事情:
pm.test("Body is correct",function(){
pm.response.to.have.body("
[
{
"key": "Dateline Standard Time","value": "(UTC-12:00) International Date Line West"
},{
"key": "UTC-11","value": "(UTC-11:00) Coordinated Universal Time-11"
},{
"key": "Aleutian Standard Time","value": "(UTC-10:00) Aleutian Islands"
}]
");
但还是不行。
谢谢!
解决方法
#! python3
# Takes multiple text files as CLI arguments and writes
# each line to consecutive rows in a column
import openpyxl
import sys
# Open a blank workbook to populate.
wb = openpyxl.Workbook()
sheet = wb.active
# Loop through the text files.
for arg in range(1,len(sys.argv)):
text_file = open(sys.argv[arg],'r')
text = text_file.readlines()
for line in range(len(text)):
sheet.cell(row=line+1,column=arg,value=text[line])
# Write spreadsheet file
wb.save('text_to_spreadsheet.xlsx')
print('DONE')`
使用深度相等
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。