My question:
Hi All! I’m a QA working with Postman and learning how to write Tests and i have a query regarding IF statements (if this is the right solution for my problem)
Essentially i have a folder labelled “Certificates” and have a couple of call within this folder, i’m making one call for some certificate information, which is returned in JSON, however i have another call which can return the certificate itself in a PDF format.
The tests I’m running daily are scheduled at the folder level for these calls and I’m wanting to know if i can write a test which includes an IF Statement, for example my current test features this:
pm.test(“Header to have Content Type ‘application/pdf’ OR ‘application/json’”, function () {
pm.expect(pm.response.headers.get('Content-Type')).to.be.oneOf(["application/json","application/pdf"]) });
i want to know if i can then take this further and say IF this returns “application/json” then i want it to see if “Example ID 1”, “Example ID 2” is returned.
Is this something that is possible?