<a href="https://www.postman.com/"><img src="https://assets.getpostman.com/common-share/postman-logo-horizontal-320x132.png" /></a><br /> Manage all of your organization's APIs in Postman, with the industry's most complete API development environment.
Newman is a command-line collection runner for Postman. It allows you to effortlessly run and test a Postman collection directly from the command-line. It is built with extensibility in mind so that you can easily integrate it with your continuous integration servers and build systems.
To run Newman, ensure that you have Node.js >= v16. Install Node.js via package manager.
The easiest way to install Newman is using NPM. If you have Node.js installed, it is most likely that you have NPM installed as well.
$ npm install -g newman
This installs Newman globally on your system allowing you to run it from anywhere. If you want to install it locally, Just remove the -g
flag.
Install Newman globally on your system using Homebrew.
$ brew install newman
The newman run
command allows you to specify a collection to be run. You can easily export your Postman
Collection as a json file from the Postman App and run it using Newman.
$ newman run examples/sample-collection.json
If your collection file is available as an URL (such as from our Cloud API service), Newman can fetch your file and run it as well.
$ newman run https://www.getpostman.com/collections/631643-f695cab7-6878-eb55-7943-ad88e1ccfd65-JsLv
For the complete list of options, refer the Command Line Options section below.
Newman can be easily used within your JavaScript projects as a Node.js module. The entire set of Newman CLI functionality is available for programmatic use as well. The following example runs a collection by reading a JSON collection file stored on disk.
const newman = require('newman'); // require newman in your project // call newman.run to pass `options` object and wait for callback newman.run({ collection: require('./sample-collection.json'), reporters: 'cli' }, function (err) { if (err) { throw err; } console.log('collection run complete!'); });
For the complete list of options, refer the API Reference section below.
Reporters provide information about the current collection run in a format that is easy to both: disseminate and assimilate.
Reporters can be configured using the -r
or --reporters
options. Inbuilt reporters in newman are: cli
, json
, junit
, progress
and emojitrain
.
CLI reporter is enabled by default when Newman is used as a CLI, you do not need to specifically provide the same as part of reporters option. However, enabling one or more of the other reporters will result in no CLI output. Explicitly enable the CLI option in such a scenario. Check the example given below using the CLI and JSON reporters:
$ newman run examples/sample-collection.json -r cli,json
For more details on Reporters and writing your own External Reporters refer to their corresponding sections below.
newman [options]
-h
, --help
<br />
Show command line help, including a list of options, and sample use cases.
-v
, --version
<br />
Displays the current Newman version, taken from package.json
newman run <collection-file-source> [options]
-e <source>
, --environment <source>
<br />
Specify an environment file path or URL. Environments provide a set of variables that one can use within collections.
Read More
-g <source>
, --globals <source>
<br />
Specify the file path or URL for global variables. Global variables are similar to environment variables but have a lower
precedence and can be overridden by environment variables having the same name.
-d <source>
, --iteration-data <source>
<br />
Specify a data source file (JSON or CSV) to be used for iteration as a path to a file or as a URL.
Read More
-n <number>
, --iteration-count <number>
<br />
Specifies the number of times the collection has to be run when used in conjunction with iteration data file.
--folder <name>
<br />
Run requests within a particular folder/folders or specific requests in a collection. Multiple folders or requests can be specified by using
--folder multiple times, like so: --folder f1 --folder f2 --folder r1 --folder r2.
--working-dir <path>
<br />
Set the path of the working directory to use while reading files with relative paths. Default to current directory.
--no-insecure-file-read
<br />
Prevents reading of files situated outside of the working directory.
--export-environment <path>
<br />
The path to the file where Newman will output the final environment variables file before completing a run.
--export-globals <path>
<br />
The path to the file where Newman will output the final global variables file before completing a run.
--export-collection <path>
<br />
The path to the file where Newman will output the final collection file before completing a run.
--timeout <ms>
<br />
Specify the time (in milliseconds) to wait for the entire collection run to complete execution.
--timeout-request <ms>
<br />
Specify the time (in milliseconds) to wait for requests to return a response.
--timeout-script <ms>
<br />
Specify the time (in milliseconds) to wait for scripts to complete execution.
-k
, --insecure
<br />
Disables SSL verification checks and allows self-signed SSL certificates.
--ignore-redirects
<br />
Prevents newman from automatically following 3XX redirect responses.
--delay-request
<br />
Specify the extent of delay between requests (milliseconds).
--cookie-jar <path>
<br />
Specify the file path for a JSON Cookie Jar. Uses tough-cookie
to deserialize the file.
--export-cookie-jar <path>
<br />
The path to the file where Newman will output the final cookie jar file before completing a run. Uses tough-cookie
's serialize method.
--bail [optional modifiers]
<br />
Specify whether or not to stop a collection run on encountering the first test script error.<br />
Can optionally accept modifiers, currently include folder
and failure
.<br />
folder
allows you to skip the entire collection run in case an invalid folder
was specified using the --folder
option or an error was encountered in general.<br />
On the failure of a test, failure
would gracefully stop a collection run after completing the current test script.
-x
, --suppress-exit-code
<br />
Specify whether or not to override the default exit code for the current run.
--color <value>
<br />
Enable or Disable colored CLI output. The color value can be any of the three: on
, off
or auto
(default).<br/>
With auto
, Newman attempts to automatically turn color on or off based on the color support in the terminal.
This behaviour can be modified by using the on
or off
value accordingly.
--disable-unicode
<br />
Specify whether or not to force the unicode disable option. When supplied, all symbols in the output will be replaced
by their plain text equivalents.
--global-var "<global-variable-name>=<global-variable-value>"
<br />
Allows the specification of global variables via the command line, in a key=value format. Multiple CLI global variables
can be added by using --global-var
multiple times, like so: --global-var "foo=bar" --global-var "alpha=beta"
.
--env-var "<environment-variable-name>=<environment-variable-value>"
<br />
Allows the specification of environment variables via the command line, in a key=value format. Multiple CLI environment variables
can be added by using --env-var
multiple times, like so: --env-var "foo=bar" --env-var "alpha=beta"
.
--verbose
<br />
Show detailed information of collection run and each request sent.
Client certificates are an alternative to traditional authentication mechanisms. These allow their users to make authenticated requests to a server, using a public certificate, and an optional private key that verifies certificate ownership. In some cases, the private key may also be protected by a secret passphrase, providing an additional layer of authentication security.
Newman supports SSL client certificates, via the following CLI options:
--ssl-client-cert
<br/>
The path to the public client certificate file.
--ssl-client-key
<br/>
The path to the private client key (optional).
--ssl-client-passphrase
<br/>
The secret passphrase used to protect the private client key (optional).
--ssl-client-cert-list
<br/>
The path to the SSL client certificate list configuration file (JSON format). See examples/ssl-client-cert-list.json.This option allows setting different SSL client certificate according to URL or hostname.
This option takes precedence over --ssl-client-cert
, --ssl-client-key
and --ssl-client-passphrase
options. If there is no match for the URL in the list, these options are used as fallback.
When it is not wanted to use the --insecure
option, additionally trusted CA certificates can be provided like this:
--ssl-extra-ca-certs
<br/>
The path to the file, that holds one or more trusted CA certificates in PEM formatNewman can also be configured to work with proxy settings via the following environment variables:
HTTP_PROXY
/ http_proxy
HTTPS_PROXY
/ https_proxy
NO_PROXY
/ no_proxy
For more details on using these variables, refer here.
The run
function executes a collection and returns the run result to a callback function provided as parameter. The
return of the newman.run
function is a run instance, which emits run events that can be listened to.
Parameter | Description |
---|---|
options | This is a required argument and it contains all information pertaining to running a collection.<br /><br />Required<br />Type: object |
options.collection | The collection is a required property of the options argument. It accepts an object representation of a Postman Collection which should resemble the schema mentioned at https://schema.getpostman.com/. The value of this property could also be an instance of Collection Object from the Postman Collection SDK.<br /><br />As string , one can provide a URL where the Collection JSON can be found (e.g. Postman Cloud API service) or path to a local JSON file.<br /><br />Required<br />Type: object|string PostmanCollection |
options.environment | One can optionally pass an environment file path or URL as string to this property and that will be used to read Postman Environment Variables from. This property also accepts environment variables as an object . Environment files exported from Postman App can be directly used here.<br /><br />Optional<br />Type: object|string |
options.envVar | One can optionally pass environment variables as an array of key-value string object pairs. It will be used to read Postman Environment Variables as well as overwrite environment variables from options.environments . <br /><br />Optional<br />Type: array|object |
options.globals | Postman Global Variables can be optionally passed on to a collection run in form of path to a file or URL. It also accepts variables as an object .<br /><br />Optional<br />Type: object|string |
options.globalVar | One can optionally pass global environment variables as an array of key-value string object pairs. It will be used to read Postman Global Environment Variables as well as overwrite global environment variables from options.globals . <br /><br />Optional<br />Type: array|object |
options.iterationCount | Specify the number of iterations to run on the collection. This is usually accompanied by providing a data file reference as options.iterationData .<br /><br />Optional<br />Type: number , Default value: 1 |
options.iterationData | Path to the JSON or CSV file or URL to be used as data source when running multiple iterations on a collection.<br /><br />Optional<br />Type: string |
options.folder | The name or ID of the folder/folders (ItemGroup) in the collection which would be run instead of the entire collection.<br /><br />Optional<br />Type: string|array |
options.workingDir | The path of the directory to be used as working directory.<br /><br />Optional<br />Type: string , Default value: Current Directory |
options.insecureFileRead | Allow reading files outside of working directory.<br /><br />Optional<br />Type: boolean , Default value: true |
options.timeout | Specify the time (in milliseconds) to wait for the entire collection run to complete execution.<br /><br />Optional<br />Type: number , Default value: Infinity |
options.timeoutRequest | Specify the time (in milliseconds) to wait for requests to return a response.<br /><br />Optional<br />Type: number , Default value: Infinity |
options.timeoutScript | Specify the time (in milliseconds) to wait for scripts to return a response.<br /><br />Optional<br />Type: number , Default value: Infinity |
options.delayRequest | Specify the time (in milliseconds) to wait for between subsequent requests.<br /><br />Optional<br |
字节跳动发布的AI编程神器IDE
Trae是一种自适应的集成开发环境(IDE),通过自动化和多元协作改变开发流程。利用Trae,团队能够更快速、精确地编写和部署代码,从而提高编程效率和项目交付速度。Trae具备上下文感知和代码自动完成功能,是提升开发效率的理想工具。
全能AI智能助手,随时解答生活与工作的多样问题
问小白,由元石科技研发的AI智能助手,快速准确地解答各种生活和工作问题,包括但不限于搜索、规划和社交互动,帮助用户在日常生活中提高效率,轻松管理个人事务。
实时语音翻译/同声传译工具
Transly是一个多场景的AI大语言模型驱动的同声传译、专业翻译助手,它拥有超精准的音频识别翻译能力,几乎零延迟的使用体验和支持多国语言可以让你带它走遍全球,无论你是留学生、商务人士、韩剧美剧爱好者,还是出国游玩、多国会议、跨国追星等等,都可以满足你所有需要同传的场景需求,线上线下通用,扫除语言障碍,让全世界的语言交流不再有国界。
一键生成PPT和Word,让学习生活更轻松
讯飞智文是一个利用 AI 技术的项目,能够帮助用户生成 PPT 以及各类文档。无论是商业领域的市场分析报告、年度目标制定,还是学生群体的职业生涯规划、实习避坑指南,亦或是活动策划、旅游攻略等内容,它都能提供支持,帮助用户精准表达,轻松呈现各种信息。
深度推理能力全新升级,全面对标OpenAI o1
科大讯飞的星火大模型,支持语言理解、知识问答和文本创作等多功能,适用于多种文件和业务场景,提升办公和日常生活的效率。讯飞星火是一个提供丰富智能服务的平台,涵盖科技资讯、图像创作、写作辅助、编程解答、科研文献解读等功能,能为不同需求的用户提供便捷高效的帮助,助力用户轻松获取信息、解决问题,满足多样化使用场景。
一种基于大语言模型的高效单流解耦语音令牌文本到语音合成模型
Spark-TTS 是一个基于 PyTorch 的开源文本到语音合成项目,由多个知名机构联合参与。该项目提供了高效的 LLM(大语言模型)驱动的语音合成方案,支持语音克隆和语音创建功能,可通过命令行界面(CLI)和 Web UI 两种方式使用。用户可以根据需求调整语音的性别、音高、速度等参数,生成高质量的语音。该项目适用于多种场景,如有声读物制作、智能语音助手开发等。
AI助力,做PPT更简单!
咔片是一款轻量化在线演示设计工具,借助 AI 技术,实现从内容生成到智能设计的一站式 PPT 制作服务。支持多种文档格式导入生成 PPT,提供海量模板、智能美化、素材替换等功能,适用于销售、教师、学生等各类人群,能高效制作出高品质 PPT,满足不同场景演示需求。
选题、配图、成文,一站式创作,让内容运营更高效
讯飞绘文,一个AI集成平台,支持写作、选题、配图、排版和发布。高效生成适用于各类媒体的定制内容,加速品牌传播,提升内容营销效果。
专业的AI公文写作平台,公文写作神器
AI 材料星,专业的 AI 公文写作辅助平台,为体制内工作人员提供高效的公文写作解决方案。拥有海量公文文库、9 大核心 AI 功能,支持 30 + 文稿类型生成,助力快速完成领导讲话、工作总结、述职报告等材料,提升办公效率,是体制打工人的得力写作神器。
OpenAI Agents SDK,助力开发者便捷使用 OpenAI 相关功能。
openai-agents-python 是 OpenAI 推出的一款强大 Python SDK,它为开发者提供了与 OpenAI 模型交互的高效工具,支持工具调用、结果处理、追踪等功能,涵盖多种应用场景,如研究助手、财务研究等,能显著提升开发效率,让开发者更轻松地利用 OpenAI 的技术优势。
最新AI工具、AI资讯
独家AI资源、AI项目落地
微信扫一扫关注公众号