{"id":15014410,"url":"https://github.com/reportportal/agent-js-postman","last_synced_at":"2025-04-07T19:16:12.250Z","repository":{"id":42221703,"uuid":"166978675","full_name":"reportportal/agent-js-postman","owner":"reportportal","description":"Agent to integrate Postman (based on Newman collection runner) with ReportPortal.","archived":false,"fork":false,"pushed_at":"2025-03-28T15:00:50.000Z","size":888,"stargazers_count":18,"open_issues_count":15,"forks_count":8,"subscribers_count":23,"default_branch":"develop","last_synced_at":"2025-03-31T18:20:58.201Z","etag":null,"topics":["newman","newman-reporter","postman","postman-reporter"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@reportportal/newman-reporter-agent-js-postman","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/reportportal.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-22T10:58:21.000Z","updated_at":"2024-11-21T03:03:40.000Z","dependencies_parsed_at":"2023-02-06T13:17:01.077Z","dependency_job_id":"eeb18949-6338-46cf-b628-dada07328936","html_url":"https://github.com/reportportal/agent-js-postman","commit_stats":{"total_commits":211,"total_committers":19,"mean_commits":"11.105263157894736","dds":0.7440758293838863,"last_synced_commit":"2101db70edadb8d05dbc3ba894f046acb03f3a1e"},"previous_names":["reportportal/agent-postman"],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reportportal%2Fagent-js-postman","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reportportal%2Fagent-js-postman/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reportportal%2Fagent-js-postman/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reportportal%2Fagent-js-postman/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/reportportal","download_url":"https://codeload.github.com/reportportal/agent-js-postman/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247713258,"owners_count":20983683,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["newman","newman-reporter","postman","postman-reporter"],"created_at":"2024-09-24T19:45:35.785Z","updated_at":"2025-04-07T19:16:12.217Z","avatar_url":"https://github.com/reportportal.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @reportportal/agent-js-postman\n\nAgent to integrate Postman (based on Newman collection runner) with ReportPortal.\n* More about [Postman](https://www.postman.com/)\n* More about [Newman](https://github.com/postmanlabs/newman)\n* More about [ReportPortal](http://reportportal.io/)\n\n### How to use\nThe installation should be global if newman is installed globally, otherwise - local (replace -g from the command below with -S for a local installation).\n\n```cmd\nnpm install --save-dev @reportportal/newman-reporter-agent-js-postman\n```\n\n### Usage\n\nThere are two ways to enable this reporter - with command line or programmatically.\n\n#### With CLI\n\nTo enable this reporter you have to specify `agent-js-postman` in Newman's `-r` or `--reporters` option.\n\n```cmd\nnewman run https://postman-echo.com/status/200 \\\n  -r @reportportal/agent-js-postman \\\n  --reporter-@reportportal/agent-js-postman-debug=true \\\n  --reporter-@reportportal/agent-js-postman-endpoint=https://your-instance.com:8080/api/v1 \\\n  --reporter-@reportportal/agent-js-postman-api-key=reportportalApiKey \\\n  --reporter-@reportportal/agent-js-postman-launch=LAUNCH_NAME \\\n  --reporter-@reportportal/agent-js-postman-project=PROJECT_NAME \\\n  --reporter-@reportportal/agent-js-postman-description=LAUNCH_DESCRIPTION \\\n  --reporter-@reportportal/agent-js-postman-attributes=launchKey:launchValue;launchValueTwo \\\n  -x\n```\n\nPay attention that you **must** add **-x** or **--suppress-exit-code** parameter while running newman using CLI.\n\n#### Programmatically\n\n```javascript\nconst newman = require(\"newman\");\n\nnewman.run(\n    {\n        collection: \"./collections/newman-test_collection.json\",\n        reporters: \"@reportportal/agent-js-postman\",\n        reporter: {\n            \"@reportportal/agent-js-postman\": {\n                apiKey: \"\u003cAPI_KEY\u003e\",\n                endpoint: \"https://your.reportportal.server/api/v1\",\n                project: \"Your reportportal project name\",\n                launch: \"Your launch name\",\n                description: \"Your launch description\",\n                attributes: [\n                    {\n                        \"key\": \"launchKey\",\n                        \"value\": \"launchValue\"\n                    },\n                    {\n                        \"value\": \"launchValue\"\n                    },\n                ],\n                mode: \"DEFAULT\",\n                debug: false\n            }\n        }\n    },\n    function(err) {\n        if (err) {\n            throw err;\n        }\n        console.log(\"collection run complete!\");\n    }\n);\n\n// To run several collections\n// Note, this will create multiple launches, so you can merge into one manually via the UI or API\nfs.readdir(\"./collections_folder_path\", (err, files) =\u003e {\n    if (err) {\n        throw err;\n    }\n    files.forEach((file) =\u003e {\n        // setup newman.run()\n    });\n});\n```\n\n#### Options\n\nThe full list of available options presented below.\n\n| Option                | Necessity  | Default   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |\n|-----------------------|------------|-----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| apiKey                | Required   |           | User's reportportal token from which you want to send requests. It can be found on the profile page of this user.                                                                                                                                                                                                                                                                                                                                                                                                                                |\n| endpoint              | Required   |           | URL of your server. For example 'https://server:8080/api/v1'.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |\n| launch                | Required   |           | Name of launch at creation.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |\n| project               | Required   |           | The name of the project in which the launches will be created.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |\n| attributes            | Optional   | []        | Launch attributes. Programmatically - [{ \"key\": \"YourKey\", \"value\": \"YourValue\" }] \u003cbr/\u003e with CLI - \"YourKey:YourValue;YourValueTwo\"                                                                                                                                                                                                                                                                                                                                                                                                             |\n| description           | Optional   | ''        | Launch description.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |\n| rerun                 | Optional   | false     | Enable [rerun](https://github.com/reportportal/documentation/blob/master/src/md/src/DevGuides/rerun.md)                                                                                                                                                                                                                                                                                                                                                                                                                                          |\n| rerunOf               | Optional   | Not set   | UUID of launch you want to rerun. If not specified, reportportal will update the latest launch with the same name                                                                                                                                                                                                                                                                                                                                                                                                                                |\n| mode                  | Optional   | 'DEFAULT' | Results will be submitted to Launches page \u003cbr/\u003e *'DEBUG'* - Results will be submitted to Debug page.                                                                                                                                                                                                                                                                                                                                                                                                                                            |\n| skippedIssue          | Optional   | true      | reportportal provides feature to mark skipped tests as not 'To Investigate'. \u003cbr/\u003e Option could be equal boolean values: \u003cbr/\u003e *true* - skipped tests considered as issues and will be marked as 'To Investigate' on reportportal. \u003cbr/\u003e *false* - skipped tests will not be marked as 'To Investigate' on application.                                                                                                                                                                                                                          |\n| debug                 | Optional   | false     | This flag allows seeing the logs of the client-javascript. Useful for debugging.                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |\n| launchId              | Optional   | Not set   | The _ID_ of an already existing launch. The launch must be in 'IN_PROGRESS' status while the tests are running. Please note that if this _ID_ is provided, the launch will not be finished at the end of the run and must be finished separately.                                                                                                                                                                                                                                                                                                |\n| restClientConfig      | Optional   | Not set   | `axios` like http client [config](https://github.com/axios/axios#request-config). May contain `agent` property for configure [http(s)](https://nodejs.org/api/https.html#https_https_request_url_options_callback) client, and other client options e.g. `proxy`, [`timeout`](https://github.com/reportportal/client-javascript#timeout-30000ms-on-axios-requests). For debugging and displaying logs the `debug: true` option can be used. \u003cbr/\u003e Visit [client-javascript](https://github.com/reportportal/client-javascript) for more details. |\n| headers               | Optional   | {}        | The object with custom headers for internal http client.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |\n| launchUuidPrint       | Optional   | false     | Whether to print the current launch UUID.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |\n| launchUuidPrintOutput | Optional   | 'STDOUT'  | Launch UUID printing output. Possible values: 'STDOUT', 'STDERR', 'FILE', 'ENVIRONMENT'. Works only if `launchUuidPrint` set to `true`. File format: `rp-launch-uuid-${launch_uuid}.tmp`. Env variable: `RP_LAUNCH_UUID`, note that the env variable is only available in the reporter process (it cannot be obtained from tests).                                                                                                                                                                                                               |\n| token                 | Deprecated | Not set   | Use `apiKey` instead.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |\n\n### Report static attributes\n* To report attributes for suite you should use collection variables.\n\n| VARIABLE      | INITIAL VALUE             | CURRENT VALUE             |\n|---------------|---------------------------|---------------------------|\n| rp.attributes | keySuiteOne:valueSuiteOne | keySuiteOne:valueSuiteOne |\n\n* To report attributes for tests inside of Pre-request Script you should use the next method\n\n**pm.environment.set**\n\n| Parameter  | Required | Description                                                | Examples                                       |\n|------------|----------|------------------------------------------------------------|------------------------------------------------|\n| namespace  | true     | \"string\" - namespace, must be equal to the *rp.attributes* | \"rp.attributes\"                                |\n| attributes | true     | \"string\" - contains set of pairs *key:value*               | \"keyOne:valueOne;valueTwo;keyThree:valueThree\" |\n\n```javascript\npm.environment.set(\"rp.attributes\", \"keyOne:valueOne;valueTwo;keyThree:valueThree\");\n```\n* Step doesn't support reporting with attributes\n\n### Report static description\nBoth suites and tests support description. For reporting with description you should click on **Edit** in your collection\n and in the description column enter the text you need\n\n* Step doesn't support reporting with description\n\n### Finish with status\n**status** must be equal to one of the following values: **passed, failed, stopped, skipped, interrupted, cancelled, info, warn**.\u003cbr/\u003e\n\n* To finish launch/suite with status you should use collection variables\n\n| VARIABLE                                               | INITIAL VALUE | CURRENT VALUE |\n|--------------------------------------------------------|---------------|---------------|\n| rp.launchStatus (for launch)\u003cbr/\u003erp.status (for suite) | your status   | your status   |\n\n* To finish tests you should use environment variables inside of Pre-request Script\n```javascript\npm.environment.set(\"rp.status\", \"status\");\n```\n* To finish steps with statuses you should use local variables\n```javascript\npm.variables.set(\"rp.status\", \"status\");\n```\n**It is important that the code line above has to start from the new line and you shouldn't forget about semicolon after it**\n\nFor both tests or steps, this is true\n\n| Parameter | Required | Description                                            | Examples    |\n|-----------|----------|--------------------------------------------------------|-------------|\n| namespace | true     | \"string\" - namespace, must be equal to the *rp.status* | \"rp.status\" |\n| status    | true     | \"string\" - status                                      | \"passed\"    |\n\n### Logging\nYou can use the following methods to report logs with different log levels:\n\n* console.log(\"launch/suite/test\", \"message\");\n* console.error(\"launch/suite/test\", \"message\");\n* console.debug(\"launch/suite/test\", \"message\");\n* console.warn(\"launch/suite/test\", \"message\");\n* console.info(\"launch/suite/test\", \"message\");\n\n| Parameter | Required | Description                                                                                            | Examples       |\n|-----------|----------|--------------------------------------------------------------------------------------------------------|----------------|\n| namespace | true     | \"string\" - namespace, must be equal to the *launch, suite or test* depends on where you want to report | \"test\"         |\n| message   | true     | \"string\" - message                                                                                     | \"your message\" |\n\n* Step doesn't support logs reporting\n\n### Report test case id\n* To report suite with test case id you should use collection variables\n\n| VARIABLE      | INITIAL VALUE       | CURRENT VALUE       |\n|---------------|---------------------|---------------------|\n| rp.testCaseId | yourSuiteTestCaseId | yourSuiteTestCaseId |\n\n* To report tests with test case id you should use environment variables inside of Pre-request Script\n```javascript\npm.environment.set(\"rp.testCaseId\", \"yourTestCaseId\");\n```\n* To report steps with test case id you should use local variables\n```javascript\npm.variables.set(\"rp.testCaseId\", \"stepTestCaseId\");\n```\n**It is important that the code line above has to start from the new line and you shouldn't forget about semicolon after it**\n\nFor both tests or steps, this is true\n\n| Parameter  | Required | Description                                                | Examples         |\n|------------|----------|------------------------------------------------------------|------------------|\n| namespace  | true     | \"string\" - namespace, must be equal to the *rp.testCaseId* | \"rp.testCaseId\"  |\n| testCaseId | true     | \"string\" - test case id value                              | \"yourTestCaseId\" |\n\n# Copyright Notice\nLicensed under the [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0.html)\nlicense (see the LICENSE.txt file).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freportportal%2Fagent-js-postman","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freportportal%2Fagent-js-postman","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freportportal%2Fagent-js-postman/lists"}