【问题标题】:Getting error in Postman request as TypeError Cannot read property 'xyz' of undefined在 Postman 请求中获取错误为 TypeError 无法读取未定义的属性“xyz”
【发布时间】:2018-08-26 05:35:08
【问题描述】:

在 Postman 中运行脚本时出现错误(同样在 newman 上)请求 TypeError 无法读取未定义的属性“xyz”。

在我的请求中,我有测试脚本:

var jsonData = JSON.parse(responseBody);
tests["Response has data value"] = jsonData.from.xyz === dataAuth.auth;

dataAuth 是我在 json 中的数据文件如下:

[{
  "path": "auth",
  "id": "test11",
  "desc": "test11",
  "fk": "None",
}]

【问题讨论】:

  • 这是因为,在 jsonData 中,没有与from.xyz 相关的数据。您可以分享您的请求的响应正文吗?

标签: postman-collection-runner


【解决方案1】:

这意味着您的测试中未定义变量。

【讨论】:

    猜你喜欢
    • 2017-04-06
    • 1970-01-01
    • 1970-01-01
    • 2021-12-16
    • 1970-01-01
    • 2023-03-23
    • 2022-12-24
    • 2023-02-26
    • 1970-01-01
    相关资源
    最近更新 更多