0

I am developing a API, and have a Postman collection used with extensive tests on the endpoints. I also used Examples to be able to mock a good chunk of the API.

However, whenever something is planned to change in the response, I have to edit the tests and examples in almost the same way. In some cases, it would make sense to have the test depend directly on the example response for a part, or even the entire response.

It would make it much easier for those tests to be able to reference the example value:

const expectedStatusCode = pm.examples[0].request.status; // ???

pm.test(`Status code is ${expectedStatusCode}`, () => {
    pm.response.to.have.status(expectedStatusCode)
})

The Postman API reference how to access a lot of things, but there seems to be no way to either access the examples data nor read a file (so I could parse the collection JSON file, and fetch the value directy in the exported collection)

4

1 回答 1

0

发现所要求的功能不存在的确认,并且已经向 Postman 发出功能请求,用于直接访问示例读取外部文件

于 2019-09-13T11:10:12.113 回答