【问题标题】:Postman: Test to check the number of response body linesPostman: Test to check the number of response body lines
【发布时间】:2022-12-01 15:59:52
【问题描述】:

looking at the provided screenshot

In the response at Pretty section, I have 36 lines of data. I would like to write a test for this request, which would check if the response body lines were 36 each time the request is run. What would be your suggested test code for this test?

【问题讨论】:

    标签: api testing postman web-api-testing postman-testcase


    【解决方案1】:

    I had the same problem. Here's my solution:

    let text = pm.response.text();
    let lines = text.split("
    ");
    let length = lines.length;
    pm.expect(length).to.eql(36);
    

    【讨论】:

      猜你喜欢
      • 2022-12-01
      • 1970-01-01
      • 2022-12-26
      • 2022-12-02
      • 2022-12-27
      • 2022-12-16
      • 2022-12-02
      • 2022-12-02
      • 2023-02-20
      相关资源
      最近更新 更多