be able to run tests on a postman style request
armandofcom opened this issue Β· comments
π I have found these related issues/pull requests
being able to do surveys on the results returned by an example get request that returns a json and parse that json and create some queries, how we do a test in postman, example
var data = JSON.parse(responseBody);
pm.test("Status code is 200", function () {
pm.response.to.have.status(200);
});
console.log(new Date().getTime()-Date.parse(data.items[0].lastConnection));
pm.test("Last Connection Date", function () {
pm.expect(new Date().getTime()-Date.parse(data.items[0].lastConnection)).to.be.below(480000);
});
π·οΈ Feature Request Type
New monitor
π Feature description
being able to do surveys on the results returned by an example get request that returns a json and parse that json and create some queries, how we do a test in postman, example
βοΈ Solution
You should also keep in mind that it is possible that a new authentication method must be passed, which may be that you send a POST-style request where you send a raw style json and that you parse that response so that it can be used to consult the api or the enpoint a monitor
var data = JSON.parse(responseBody);
//postman.setEnvironmentVariable("token", data.token);
pm.globals.set("token", data.token);
β Alternatives
No response
π Additional Context
No response
I think with "survey" you mean you want to execute queries against json
.
Have you looked at the json-query
monitor, which does exactly what you are proposing (doing a request, checking the result).
Unsure what you mean by
You should also keep in mind that it is possible that a new authentication method must be passed, which may be that you send a POST-style request where you send a raw style json and that you parse that response so that it can be used to consult the api or the enpoint a monitor
Yes, I already saw that with queries to that json it might work for me, I am investigating more to see if that would work, and with respect to authentication I mean that right now I have to send the following header that I obtained from the login
{
"Authorization": "Bearer *******"
}
Given that you can attach said header, I think this issue is resolved