How to know that no request was executed?

Hi all!

I have a collection with several folders.
Each folder represents a test case.
From newman when I run a case I use the --folder to specify which case I want to run and --htmlextra to generate the reports by case.
What I see is that if the folder does not contain any request, a report is generated but empty and the exitCode that I get is 0.
How can I know if when I execute a folder of a collection, if it contains some request?

Additionally, is there an API to integrate newman or postman from java?

Thanks and regards.

Pablo.

HI @pablovok, welcome to the Postman community :slight_smile:

I’d be curious to know how you might end up trying to run a folder in a collection that has no requests in it? It seems odd that you might end up doing that?

There’s a few ways you might be able to handle this, but all of them need to happen before or after you run Newman. eg you could look into the collection file (it’s just JSON after all) and see if the folder contains any requests. Alternatively, you could read into the generated report and delete it if it has no requests in it, or you could run with an additional reporter for a file format you are comfortable looking into.

Oh yeah, nearly forgot, I don’t think there’s anything specific to integrate newman with java, but newman can be run as a module from a javascript, eg in node.js. Maybe this stackoverflow might help you get that going.

Hello!
Thank you for answering me. If I thought about it, but I wanted to know if there was any way for Newman to let me know that the folder of the collection I was running did not have any request.

Without any further details, all I can suggest is that there’s no need to run Newman, just open the collection JSON file (eg. with node.js) and check if the folder has any requests in it.