Negative API testing

Hello, I want to test negative GET API requests. I have already positive requests so should I add negative scenarios to the existing positive test scripts in tests tab as pm.sendRequest with invalid value or should I create new negative scenarios? What’s the best practise?

pm.globals.set(“productId”,“abcde”); pm.test(“Status code is 404”, function (){ pm.sendRequest(‘{{productId}}/stock-availability?Ids=24’, function (error, response) {; }); });

This code inside tests tab after positive test scripts doesn’t work.

@michaldrajna Thanks for posting and welcome to the community.

In my opinion and in practice I break out negative scenarios into their own respective requests in my collections.

The main reason for doing this is you can get a clear picture of what is failing and you are not mixing up scenarios in a single call.

The additional effort is minimal but the clarity it gives yourself and others looking at the results is well worth it.