Hi
I’m changing our server port through our API and I want to check that when I change the port, the old one is actually closed, however when I send a request on the old port, and get the “Error: connect ECONNREFUSED”, it seems that the testing code is skipped.
Also, the execution stops when this error is thrown.
Test scripts are executed after request is sent and pre-request scripts are executed in prior.
As the request itself is returning the error, test scripts are not executed in your case.
Instead of including your test in Tests, you can include in Pre-request scripts, e.g.
pm.sendRequest('localhost:4000', (err, res) => {
if (err) {
throw new Error('No connection')
} else {
console.log(res)
}
})