Hello, so hot topic.
I saw a lot of similar Q&A around this theme.
But still can not find the solution for my case:
I have a main, required test with a few expected results, and if one of them is failed β test is failed, the point is if the test is failed is not make sense to run others.
pm.test("Request is valid and has a body: " + pm.collectionVariables.get("exchange"), function () {
pm.response.to.have.status(200);
pm.response.to.be.json;
pm.expect(data.length).to.gt(0);
});
Now I use such construction
let skipTest = data.length === 0;
(skipTest ? pm.test.skip : pm.test)("Each array item have required fields: " + pm.collectionVariables.get("exchange"), function () {
data.forEach(function(item) {
pm.expect(item).to.have.all.keys('base', 'quote', 'volume', 'price', 'volumePercent', 'spread', 'category', 'time');
});
});
But in the skipTest part only one check
Is there any way to put in the variable skipTest a boolean value that the first test failed?