Today is my first day with postman. So far happy except about the below thing
Could any one please share your knowledge why the test is not failing here. Please see the attached pic to know what I am doing here
So this test doesn’t actually test anything here, thats why its passing. If you want it to fail, you could try changing the call or its parameters to return something other than a 200.
You can even do some sort of check that you know would fail like looking for a string.
pm.test("Does this fail?", function () {
pm.expect(pm.response.text()).to.include("Postman FTW!");
});
The function accepts 2 parameters, the name of the test (as a string) and a function to return a Boolean value.
So having a function as a second parameter which returns a boolean is not going to work all the time if it is not doing the real test ? I think I will read more about this
The pm.test is a test block. The block is executing a bunch of assertion. This semantics is similar to a most of javascript testing frameworks. For example the it block in mocha.js.
The pm.expect extends on chai.js assertions. If you want a test that fails always you can use fail assertion method.