@abhijoseph/newman-reporter-reportportal 中文文档教程
newman-reporter-reportportal
EPAM 报告门户 的 Newman runtime reporter,它提供有关收集运行的信息。
Install
如果全局安装了 newman,则安装应该是全局的,否则 - 本地(将下面命令中的 -g 替换为 -S 以进行本地安装)。
$ npm install -g @reportportal/newman-reporter-reportportal
Usage
有两种方法可以启用此报告程序 - 使用命令行或以编程方式。
With CLI
要启用此报告程序,您必须在 Newman 的 -r
或 --reporters
选项中指定 reportportal
。
$ newman run https://postman-echo.com/status/200 \
-r @reportportal/reportportal \
--reporter-@reportportal/reportportal-debug=true \
--reporter-@reportportal/reportportal-endpoint=http://your-instance.com:8080/api/v1 \
--reporter-@reportportal/reportportal-token=00000000-0000-0000-0000-000000000000 \
--reporter-@reportportal/reportportal-launch=LAUNCH_NAME \
--reporter-@reportportal/reportportal-project=PROJECT_NAME \
-x
请注意,在使用 CLI 运行 newman 时,您必须添加-x 或--suppress-exit-code 参数。
Programmatically
const newman = require("newman");
newman.run(
{
collection: "./collections/newman-test_collection.json",
reporters: "@reportportal/reportportal",
reporter: {
"@reportportal/reportportal": {
debug: true,
endpoint: "http://your-instance.com:8080/api/v1",
token: "00000000-0000-0000-0000-000000000000",
launch: "LAUNCH_NAME",
project: "PROJECT_NAME"
}
}
},
function(err) {
if (err) {
throw err;
}
console.log("collection run complete!");
}
);
Options
CLI 和编程运行都支持以下选项:
Parameter | Description |
---|---|
token | User's Report Portal toke from which you want to send requests. It can be found on the profile page of this user. |
endpoint | URL of your server. For example 'https://server:8080/api/v1'. |
launch | Name of launch at creation. |
project | The name of the project in which the launches will be created. |
debug | Determines whether newman's run should be logged in details. |
Docker
这个报告器也可以在 docker 容器内使用。
Using existing image
本记者的 docker 镜像可从我们的 docker hub 下载。 因此,首先您必须确保已在系统中安装并运行 docker。 否则,请参阅安装指南 你的操作系统。
Step 1
从 docker hub 中拉取 newman docker image with installed reporter:
$ docker pull reportportal/newman
Step 2
在图像上运行 newman 命令:
$ docker run -t reportportal/newman run https://www.getpostman.com/collections/8a0c9bc08f062d12dcda \
-r @reportportal/reportportal \
--reporter-@reportportal/reportportal-debug=true \
--reporter-@reportportal/reportportal-endpoint=http://your-instance.com:8080/api/v1 \
--reporter-@reportportal/reportportal-token=00000000-0000-0000-0000-000000000000 \
--reporter-@reportportal/reportportal-launch=LAUNCH_NAME \
--reporter-@reportportal/reportportal-project=PROJECT_NAME \
-x
如果您想将此报告程序用于特定的集合 JSON 文件,您必须使用此文件安装一个目录:
$ docker run -v ~/collections:/etc/newman -t reportportal/newman run "example_postman-collection.json" \
-r @reportportal/reportportal \
--reporter-@reportportal/reportportal-debug=true \
--reporter-@reportportal/reportportal-endpoint=http://your-instance.com:8080/api/v1 \
--reporter-@reportportal/reportportal-token=00000000-0000-0000-0000-000000000000 \
--reporter-@reportportal/reportportal-launch=LAUNCH_NAME \
--reporter-@reportportal/reportportal-project=PROJECT_NAME \
-x
Build the docker image from this repository
第 1 步:
克隆此存储库:
$ git clone https://github.com/reportportal/agent-postman
第 2 步:
构建图像:
$ docker build -t reportportal/newman --build-arg VERSION="full semver version".
第 3 步:
使用 newman 图像运行集合:
$ docker run -t reportportal/newman run https://www.getpostman.com/collections/8a0c9bc08f062d12dcda \
-r @reportportal/reportportal \
--reporter-@reportportal/reportportal-debug=true \
--reporter-@reportportal/reportportal-endpoint=http://your-instance.com:8080/api/v1 \
--reporter-@reportportal/reportportal-token=00000000-0000-0000-0000-000000000000 \
--reporter-@reportportal/reportportal-launch=LAUNCH_NAME \
--reporter-@reportportal/reportportal-project=PROJECT_NAME \
-x
Copyright Notice
根据 Apache License v2.0 获得许可
Contribution and Support
由 Ahold Delheize 实施和支持
newman-reporter-reportportal
Newman runtime reporter for EPAM report portal which provides information about collection run.
Install
The installation should be global if newman is installed globally, otherwise - local (replace -g from the command below with -S for a local installation).
$ npm install -g @reportportal/newman-reporter-reportportal
Usage
There are two ways to enable this reporter - with command line or programmatically.
With CLI
To enable this reporter you have to specify reportportal
in Newman's -r
or --reporters
option.
$ newman run https://postman-echo.com/status/200 \
-r @reportportal/reportportal \
--reporter-@reportportal/reportportal-debug=true \
--reporter-@reportportal/reportportal-endpoint=http://your-instance.com:8080/api/v1 \
--reporter-@reportportal/reportportal-token=00000000-0000-0000-0000-000000000000 \
--reporter-@reportportal/reportportal-launch=LAUNCH_NAME \
--reporter-@reportportal/reportportal-project=PROJECT_NAME \
-x
Pay attention that you must add -x or --suppress-exit-code parameter while running newman using CLI.
Programmatically
const newman = require("newman");
newman.run(
{
collection: "./collections/newman-test_collection.json",
reporters: "@reportportal/reportportal",
reporter: {
"@reportportal/reportportal": {
debug: true,
endpoint: "http://your-instance.com:8080/api/v1",
token: "00000000-0000-0000-0000-000000000000",
launch: "LAUNCH_NAME",
project: "PROJECT_NAME"
}
}
},
function(err) {
if (err) {
throw err;
}
console.log("collection run complete!");
}
);
Options
Both CLI and programmatic runs support following options:
Parameter | Description |
---|---|
token | User's Report Portal toke from which you want to send requests. It can be found on the profile page of this user. |
endpoint | URL of your server. For example 'https://server:8080/api/v1'. |
launch | Name of launch at creation. |
project | The name of the project in which the launches will be created. |
debug | Determines whether newman's run should be logged in details. |
Docker
This reporter can also be used inside of a docker container.
Using existing image
The docker image for this reporter is available for download from our docker hub. So, first of all you have to ensure that you have docker installed and running in your system. Otherwise, see installation guideline for you operating systems.
Step 1
Pull the newman docker image with installed reporter from docker hub:
$ docker pull reportportal/newman
Step 2
Run newman commands on the image:
$ docker run -t reportportal/newman run https://www.getpostman.com/collections/8a0c9bc08f062d12dcda \
-r @reportportal/reportportal \
--reporter-@reportportal/reportportal-debug=true \
--reporter-@reportportal/reportportal-endpoint=http://your-instance.com:8080/api/v1 \
--reporter-@reportportal/reportportal-token=00000000-0000-0000-0000-000000000000 \
--reporter-@reportportal/reportportal-launch=LAUNCH_NAME \
--reporter-@reportportal/reportportal-project=PROJECT_NAME \
-x
If you want to use this reporter for a specific collection JSON file, you have to mount a directory with this file:
$ docker run -v ~/collections:/etc/newman -t reportportal/newman run "example_postman-collection.json" \
-r @reportportal/reportportal \
--reporter-@reportportal/reportportal-debug=true \
--reporter-@reportportal/reportportal-endpoint=http://your-instance.com:8080/api/v1 \
--reporter-@reportportal/reportportal-token=00000000-0000-0000-0000-000000000000 \
--reporter-@reportportal/reportportal-launch=LAUNCH_NAME \
--reporter-@reportportal/reportportal-project=PROJECT_NAME \
-x
Build the docker image from this repository
Step 1:
Clone this repository:
$ git clone https://github.com/reportportal/agent-postman
Step 2:
Build the image:
$ docker build -t reportportal/newman --build-arg VERSION="full semver version".
Step 3:
Run a collection using the newman image:
$ docker run -t reportportal/newman run https://www.getpostman.com/collections/8a0c9bc08f062d12dcda \
-r @reportportal/reportportal \
--reporter-@reportportal/reportportal-debug=true \
--reporter-@reportportal/reportportal-endpoint=http://your-instance.com:8080/api/v1 \
--reporter-@reportportal/reportportal-token=00000000-0000-0000-0000-000000000000 \
--reporter-@reportportal/reportportal-launch=LAUNCH_NAME \
--reporter-@reportportal/reportportal-project=PROJECT_NAME \
-x
Copyright Notice
Licensed under the Apache License v2.0
Contribution and Support
Implemented and supported by Ahold Delheize