I have two tests test A and test B. I want B to run only if A has passed. How can i do that in postman?
pm.test("Status code is 200", function() {
pm.response.to.have.status(200);
});
pm.test("Check if fruits found with this search criteria", function() {
pm.expect(responseData.Message).to.not.eql("No fruits found with this search criteria");
});
I want to run a third test only if these two test cases pass. How can I do that? Thanks in advance.
You can simply nest your tests:
pm.test("Status code is 200", function() {
pm.response.to.have.status(200);
pm.test("Check if fruits found with this search criteria", function() {
pm.expect(responseData.Message).to.not.eql("No fruits found with this search criteria");
pm.test("Third test", function() {
//pm.expect()...
});
});
});