Newman command reference
Use Newman’s command line options to customize your collection runs. You can use options to set up a collection run, configure request delays and timeouts, specify SSL details, and more. When you run a collection iteratively, you can specify different data sets and variables for each iteration. After a run finishes, Newman exits with a status code that you can pass to your continuous integration (CI) tool.
To use options, add them to the newman run command after you specify the collection file or URL:
To view a list of available options for Newman, run the following command:
Basic options
Output usage information.
Output the version number.
Setup options
Specify the file path or URL of environment variables.
Specify the file path or URL of global variables.
Specify the local file path to a data file (JSON or CSV) to use for each iteration. To learn more, see Data file example.
Specify the number of times for the collection to run. Use with the iteration data file.
Specify a folder to run requests from. You can specify more than one folder by using this option multiple times, specifying one folder for each time the option is used.
Set the path of the working directory to use while reading files with relative paths. Defaults to the current directory.
Prevents reading of files located outside of the working directory.
The path to the file where Newman will output the final environment variables file before completing a run.
The path to the file where Newman will output the final global variables file before completing a run.
The path to the file where Newman will output the final collection file before completing a run.
The Postman API key used to load resources using the Postman API.
Request options
Specify a delay (in milliseconds) between requests.
Specify the time (in milliseconds) to wait for the entire collection run to complete.
Specify the time (in milliseconds) to wait for requests to return a response.
Specify the time (in milliseconds) to wait for scripts to complete.
SSL options
The path to the public client certificate file. Use this option to make authenticated requests.
Optionally, you can add the path to the private client key that verifies certificate ownership.
Optionally, you can add a secret passphrase to protect the private client key.
The path to the configuration JSON file containing the SSL client certificate list. Use this option to set several SSL client certificates according to a URL or hostname. To learn more, see an example client certificate list.
This option has a higher priority over the --ssl-client-cert, --ssl-client-key, and --ssl-client-passphrase options. If there is no URL match in the SSL client certificate list, these options are used instead.
The path to the file that has one or more trusted CA certificates in PEM format. You can use this option when you don’t want to use the --insecure option.
Output options
Specify the color of the CLI output: on, off, or auto (default).
Show detailed information of the collection run and each request sent.
Prevent Newman from showing CLI output.
Specify whether to override the default exit code for the current run. Continue running tests even after a failure, but exit with code=0. To learn more, see Exit status.
Turn off Unicode text encoding. When supplied, all symbols in the output will be replaced by their plain text equivalents.
Generate a report about the current collection run. Specify one or more reporter names: cli (default when using Newman as a CLI), json, junit, progress, and emojitrain. Specify more than one reporter name as a comma-separated list, for example, -r cli,json. Learn more about using reporters with Newman.
More configuration options
Stops the collection run when a test script fails.
Optionally, you can add modifiers to this option: folder and failure. You can add folder to skip the entire collection run if an invalid folder was specified using the --folder option, or an error was encountered in general. You can add failure to stop an entire collection run (after completing the current test script) when a test fails.
Turn off SSL verification checks, and allow self-signed SSL certificates.
Turn off automatic following of 3XX redirect responses.
Specify the file path for a JSON Cookie Jar. Uses tough-cookie to deserialize the file.
The path to the file where Newman will output the final cookie jar file before completing a run. Uses tough-cookie to serialize the file.
Specifies global variables on the command line, in a key=value format. Multiple global variables can be added by using --global-var multiple times, for example, --global-var "color=blue" --global-var "pet=cat".
Specifies environment variables in a key=value format on the command line. You can add multiple environment variables using --env-var multiple times, for example: --env-var "color=blue" --env-var "pet=cat".
Exit status
By default, Newman exits with a status code of 0 if everything runs as expected without any exceptions. You can configure your continuous integration (CI) tool to pass or fail a build based on Newman’s exit codes. To override the default exit code for the current run, use -x or --suppress-exit-code option.
Use the --bail option to make Newman stop a run if it encounters a test case error with a status code of 1. This status code can then be used by your CI tool or build system. For example:
Data file example
To use a different set of data or variables for each iteration in a collection run, use the -d option to specify a JSON or CSV file.
The following example shows a JSON data file for a run with two iterations, with each iteration using different values for a set of variables.
To run the collection, use the -d option and specify the data file. For example:
The following example shows the same data formatted in a CSV file.
To learn more about formatting data files for collection runs, see Run collections using imported data.