Skip Request Feature in Newman

The new skipRequest() feature that was added in November is great functionality, we are using it to eliminate false negatives in our automation testing.

It works great within Postman whether we run a request individually or through the collection runner, but when we push those changes up to a pipeline that runs on Newman, the tests fail with this error message:

Cannot read properties of undefined (reading 'skipRequest')

image

This is the full snippet we are using in the pre-request script, again it works perfectly within Postman, but not in a pipeline with Newman.

if (pm.environment.get("OrderNumber") == 0 || pm.environment.get("OrderNumber") == null){
    pm.execution.skipRequest()
}

Based on this PR, it should be up and running in Newman right?

Any ideas on what we could be doing wrong?

Our pipeline pulls the latest version of Newman before it kicks off the tests.

Hey @bstokesmelaleuca :wave:

Welcome to the Postman Community! :postman:

Are you able to confirm the Newman version that you have running in your pipeline as part of the test? Are you able to add a newman -v statement to print that to the console?

Do you have these only in the individual requests or are these also at the folder or collection level pre-request scripts?

@danny-dainton, version 5.3.2 is what is being used in the pipeline, so that’s my problem… Thanks for pointing out what should have been obvious. I’ll figure out why the latest version is not being installed when it should be and get that fixed.

The skipRequest is only being used at an individual requests level, nothing at folder or collection level.

1 Like

I thought it might have be the case, as the skipRequest feature was added to Newman as part of the 6.1.0 release.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.