Code Monkey home page Code Monkey logo

agent-js-postman's Introduction

Join Slack chat! stackoverflow GitHub contributors Docker Pulls License Build with Love lambdaTest a27c44

Repositories structure

ReportPortal high level architecture

reportportal high level architecture

ReportPortal repositories structure

Report Portal organized into multiple repositories.

ReportPortal server side consists of the following services:

  • service-authorization Authorization Service. In charge of access tokens distribution
  • service-api API Service. Application Backend
  • service-ui UI Service. Application Frontend
  • service-index Index Service. Info and health checks per service.
  • service-analyzer Analyzer Service. Finds most relevant test fail problem.
  • gateway Traefik Gateway Service. Main entry point to application. Port used by gateway should be opened and accessible from outside network.
  • rabbitmq Load balancer for client requests. Bus for messages between servers.
  • minio Attachments storage.

Available plugins developed by ReportPortal team:

Client side adapters related repositories:

  • client-* - API integrations. Http clients, which process HTTP request sending.
  • agent-* - Frameworks integration. Custom reporters/listeners, which monitor test events and trigger event sending via client-*
  • logger-* - Logging integration. Logger appenders, which help to collect logs, bind it with test-case item via agent-* and send to server via client-*

Other repositories stored according to next rules

  • service-* - micro-services which are a part of Application
  • commons-* - common libraries, models, etc., used by micro-services

Installation steps

Simple setup with Docker

It's the best way for demo purposes and small teams. The database is already in the docker-compose.

  1. Install Docker (Engine, Compose)

  2. Download Example of docker-compose descriptor to any folder

  3. Deploy ReportPortal using docker compose plugin within the same folder

docker compose -p reportportal up

To start ReportPortal in daemon mode, add '-d' argument:

docker compose -p reportportal up -d
  1. Open in your browser IP address of deployed environment at port 8080
http://IP_ADDRESS:8080
  1. Use next login\pass for access:
  • default\1q2w3e
  • superadmin\erebus.

Please change admin password for security.

Mentioned compose file deploy all available Bug Tracking System integrations, which not always needed, but use resources.

Production-ready set and Custom deployment with Docker

For production usage, we recommend:

  • choose only required Bug Tracking System integration service. Exclude the rest

To customize deployment and make it production-ready please follow customization steps and details

Integration. How to get log data in

You should add Client Side code inside your test automation. It consists of:

  • client-* - API integrations. Http clients, which process HTTP request sending. E.g. for Java (client-java-*)
  • agent-* - Frameworks integration. Custom reporters/listeners, which monitor test events and trigger event sending via client-*
  • logger-* - Logging integration. Logger appenders, which helps to collect logs, bind it with test-case via agent-* and send to server via client-*

Integration steps and documentation

Contribution

There are many different ways to contribute to Report Portal's development, just find the one that best fits with your skills. Examples of contributions we would love to receive include:

  • Code patches
  • Documentation improvements
  • Translations
  • Bug reports
  • Patch reviews
  • UI enhancements

Big features are also welcome but if you want to see your contributions included in Report Portal codebase we strongly recommend you start by initiating a chat through our Team in Slack.

Contribution details

Documentation

Community / Support

License

Report Portal is Apache 2.0.

agent-js-postman's People

Contributors

aliakseiliasnitski avatar amsterget avatar avarabyeu avatar bam6ycha avatar chivekrodis avatar dependabot[bot] avatar groov1kk avatar katrin-kot avatar katsiarynatatarynovich avatar renkyoji avatar ruslanlyubimov avatar tr1ble avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

agent-js-postman's Issues

Unable to connect with remote Report Portal instance, but localhost is provided in error output

Newman version: 5.2.2
agent-js-postman version: 5.0.0

I launch newman in such manner:

newman  run <snip>.json -e <snip>.json  --bail \
    -r @reportportal/agent-js-postman \
    --reporter-@reportportal/agent-js-postman-endpoint=https://reportportal.<snip>.io/api/v1 \
    --reporter-@reportportal/agent-js-postman-token=<snip> \
    --reporter-@reportportal/agent-js-postman-launch=<snip> \
    --reporter-@reportportal/agent-js-postman-project=<snip> \
    -x

and receive following output:

Error: connect ECONNREFUSED 127.0.0.1:80
    at axios.then.catch (/usr/lib/node_modules/@reportportal/newman-reporter-agent-js-postman/node_modules/@reportportal/client-javascript/lib/rest.js:31:23)
    at process._tickCallback (internal/process/next_tick.js:68:7)
Error: connect ECONNREFUSED 127.0.0.1:80
    at axios.then.catch (/usr/lib/node_modules/@reportportal/newman-reporter-agent-js-postman/node_modules/@reportportal/client-javascript/lib/rest.js:31:23)
    at process._tickCallback (internal/process/next_tick.js:68:7)
Error: connect ECONNREFUSED 127.0.0.1:80
    at axios.then.catch (/usr/lib/node_modules/@reportportal/newman-reporter-agent-js-postman/node_modules/@reportportal/client-javascript/lib/rest.js:31:23)
    at process._tickCallback (internal/process/next_tick.js:68:7)
Error: connect ECONNREFUSED 127.0.0.1:80
    at axios.then.catch (/usr/lib/node_modules/@reportportal/newman-reporter-agent-js-postman/node_modules/@reportportal/client-javascript/lib/rest.js:31:23)
    at process._tickCallback (internal/process/next_tick.js:68:7)
Error: connect ECONNREFUSED 127.0.0.1:80
    at axios.then.catch (/usr/lib/node_modules/@reportportal/newman-reporter-agent-js-postman/node_modules/@reportportal/client-javascript/lib/rest.js:31:23)
    at process._tickCallback (internal/process/next_tick.js:68:7)
Error: connect ECONNREFUSED 127.0.0.1:80
    at axios.then.catch (/usr/lib/node_modules/@reportportal/newman-reporter-agent-js-postman/node_modules/@reportportal/client-javascript/lib/rest.js:31:23)
    at process._tickCallback (internal/process/next_tick.js:68:7)
Error: connect ECONNREFUSED 127.0.0.1:80
    at axios.then.catch (/usr/lib/node_modules/@reportportal/newman-reporter-agent-js-postman/node_modules/@reportportal/client-javascript/lib/rest.js:31:23)
    at process._tickCallback (internal/process/next_tick.js:68:7)
Error: connect ECONNREFUSED 127.0.0.1:80
    at axios.then.catch (/usr/lib/node_modules/@reportportal/newman-reporter-agent-js-postman/node_modules/@reportportal/client-javascript/lib/rest.js:31:23)
    at process._tickCallback (internal/process/next_tick.js:68:7)
Error: connect ECONNREFUSED 127.0.0.1:80
    at axios.then.catch (/usr/lib/node_modules/@reportportal/newman-reporter-agent-js-postman/node_modules/@reportportal/client-javascript/lib/rest.js:31:23)
    at process._tickCallback (internal/process/next_tick.js:68:7)
Error: connect ECONNREFUSED 127.0.0.1:80
    at axios.then.catch (/usr/lib/node_modules/@reportportal/newman-reporter-agent-js-postman/node_modules/@reportportal/client-javascript/lib/rest.js:31:23)
    at process._tickCallback (internal/process/next_tick.js:68:7)
Error: connect ECONNREFUSED 127.0.0.1:80
    at axios.then.catch (/usr/lib/node_modules/@reportportal/newman-reporter-agent-js-postman/node_modules/@reportportal/client-javascript/lib/rest.js:31:23)
    at process._tickCallback (internal/process/next_tick.js:68:7)

This happens regardless if I provide endpoint by hostname only, or with endpoint path /api/v1. What I've managed to identify is that it seems to be an axios problem - when no host is provided, is tries to connect to 127.0.0.1:80 by default.

If the length of the Failures array is zero, the status is still set to failed

I think there is a missing condition in the reporter.js file in the onDone function, because if the length of the Failures array is zero, the status is still set to failed.

Attaching the image with the problem on the top, and below is a possible solution.

File path node_modules\@reportportal\newman-reporter-agent-js-postman\lib\reporter.js

Untitled-1

Schema Validation issues. Not ending launch

In our suite we have been using the following:

pm.test("Validate schema 2", ()=> { pm.response.to.have.jsonSchema(JSON.parse(pm.collectionVariables.get("schema"))); });

In ReportPortal this doesn't seem to validate/result in an 'finish' result.

Changing to:

pm.test("Validate schema 1", function() { pm.expect(tv4.validate(pm.response.json(),((JSON.parse(pm.collectionVariables.get("schema"))),true,true))).to.be.true; });

image

image

Then frustratingly when removing "Validate Schema 2" ... it also then doesn't work for "Validate Schema 1" though it did before... so something somewhere isn't right when it comes to validating schemas.

image

Incidently, postman itself has no issues with either:

image

newman: could not find "@reportportal/agent-js-postman" reporter

Getting below issue:
newman: could not find "@reportportal/agent-js-postman" reporter
ensure that the reporter is installed in the same directory as newman
please install reporter using npm

Docker:
FROM public.ecr.aws/docker/library/ruby:alpine3.15

RUN apk --update --no-cache add build-base libffi-dev mariadb-connector-c-dev bash
RUN apk add --update nodejs npm

RUN npm install newman -g
RUN npm i @reportportal/newman-reporter-agent-js-postman -g
RUN gem install bundler:2.3.7

WORKDIR /app
COPY . ./
RUN bundle install

ENTRYPOINT ["./docker-entrypoint"]

Docker entry point file:

newman run apiCollection1.json -e QA_Env_Updated.json
-r @reportportal/agent-js-postman --reporter-@reportportal/agent-js-postman-debug=true
--reporter-@reportportal/agent-js-postman-endpoint="${RP_ENDPOINT}"
--reporter-@reportportal/agent-js-postman-token="${RP_UUID}"
--reporter-@reportportal/agent-js-postman-launch=PostmanCollection_"${ENV}"
--reporter-@reportportal/agent-js-postman-project="${RP_PROJECT}" -x

Issue:

Recently facing this issue when newman did not able to find "@reportportal/agent-js-postman" reporter but I can see it successfully getting installed. Please help me what I missed here.
issue-1

Cannot read property 'requestError' of undefined and RP lunch is not ending

Hello ,
i'm running newman.run using the below script.
all work fine if the collect does not have error. but if there are some error i take the error :

`Success start item hxq44kjwfcy0t6
Success start item hxq44kjwfcy0t7
Success start item hxq44kjwfcy0un
Start test item hxq44kjwfcy0vd
Start test item hxq44kjwfcy1ab
Start test item hxq44kjwfcy1f7
C:\Runs\Postman\node_modules@reportportal\newman-reporter-reportportal\lib\index.js:260
if (execution.requestError) {
^

TypeError: Cannot read property 'requestError' of undefined
at finishSteps (C:\Runs\Postman\node_modules@reportportal\newman-reporter-reportportal\lib\index.js:260:22)
at EventEmitter.emitter.on (C:\Runs\Postman\node_modules@reportportal\newman-reporter-reportportal\lib\index.js:175:13)
at EventEmitter.emit (C:\Runs\Postman\node_modules\eventemitter3\index.js:203:33)
at done (C:\Runs\Postman\node_modules\newman\lib\run\index.js:278:29)
at C:\Runs\Postman\node_modules\postman-runtime\lib\backpack\index.js:58:34
at PostmanCollectionRun._process (C:\Runs\Postman\node_modules\postman-runtime\lib\runner\run.js:163:13)
at PostmanCollectionRun. (C:\Runs\Postman\node_modules\postman-runtime\lib\runner\run.js:169:76)
at ontimeout (timers.js:469:11)
at tryOnTimeout (timers.js:304:5)
at Timer.listOnTimeout (timers.js:264:5)

C:\Runs\Postman>`

` newmanLocalRun: function(collections,gameId,reportPath,reportTemplate,mainLogName,logsPath)
{
var newman = require('newman');
var async = require('async'); // https://npmjs.org/package/async

	module.exports.BKFiles(logsPath,mainLogName,logsPath,mainLogName,true)

async.eachSeries(collections, function(iteam, next)
{
console.log('START ---> ' + iteam.runName + ': ' + iteam.iterationData);
if (iteam.type === 1)
{
//if exists previus log save it addind date
module.exports.BKFiles(logsPath, iteam.dataLoggingFile, logsPath, iteam.dataLoggingFile, true);
}
var myglobal = JSON.parse(fs.readFileSync(iteam.globals.toString(), 'utf8'));
if (iteam.configGenerateData != undefined)
{
Object.keys(iteam.configGenerateData).forEach(function(key)
{
myglobal.values.push(iteam.configGenerateData[key])
});
}
var d = new Date();
d = d.getFullYear().toString() + ('0' + (d.getMonth() + 1)).slice(-2).toString() + ('0' + d.getDate()).slice(-2).toString() + "" + ('0' + d.getHours()).slice(-2).toString() + ('0' + d.getMinutes()).slice(-2).toString() + ('0' + d.getSeconds()).slice(-2).toString();
var dataObject = "";
if (iteam.iterationData !== undefined)
{
dataObject = iteam.iterationData;
}
else
{
dataObject = null;
}
newman.run(
{
collection: iteam.collection,
environment: iteam.environment,
exportEnvironment: iteam.exportEnvironment,
globals: myglobal,
iterationCount: iteam.iterationCount,
iterationData: dataObject,
folder: iteam.folder,
bail: true,
insecure: true,
stopOnError: true,
reporters: "@reportportal/reportportal",
reporter: {
"@reportportal/reportportal": {
debug: true,
endpoint: "https://web.demo.reportportal.io/api/v1",
token: "d879dd28-da0d-4772-a4ce-c91e6491ec1d",
launch: "LAUNCH_NAME",
project: "RUGGERILUCA_PERSONAL"
}
//reporters: iteam.reporters,
//reporter:
//{
// htmlextra:
// {
// export: (reportPath + gameId + '
' + iteam.runName.replace(' ', '') + '' + d + '.Html'), // If not specified, the file will be written to newman/ in the current working directory.
// template: reportTemplate, // optional, the default template will be used if one is not specified
// title: iteam.runName
// showOnlyFails: true
// }
}
}, function(err, summary)
{
if (iteam.type === 1)
{
module.exports.BKFiles(logsPath, mainLogName, logsPath, iteam.dataLoggingFile, false)
}
console.log('END ---> ' + iteam.runName);
next(err, summary);
});
},
function(err, results)
{
// process the errors/results here
});

}
}`

Postman folders not represented in ReportPortal

In the postman test suite we have folders to organise our suites, for example, setup and cleanup tasks and the different scenarios of tests within the test collection:

image

Within ReportPortal, these folders are not represented. So if there is an issue with a test (it fails) then it is harder for us to identify that test within our collection of thousands of requests because we don't know which folder to look in, this is especially more inconvenient if you have requests with the same name but in different folders for example:

image

I would suggest that the UI should either display the same hierarchy - so if we stick with this example you have accessControlFunctional V1 then when you click on that the next layer, so Setup, OrgType-Role Management etc which you have to open to then see the tests, or at the minimum the name should represent the hierarchy so rather than name: Verify Response is JSON & Validate Content-Type it would be in this instance cleanup/Verify Response is JSON & Validate Content-Type

Failure on newman run with Incorrect Request. [Field 'startTime' shouldn't be null.]

preconditions:
`$ npm install -g newman-reporter-reportportal

  • [email protected]
    added 24 packages from 20 contributors in 8.668s
    the same for:$ npm install -g @reportportal/newman-reporter-reportportal
  • @reportportal/[email protected]
    added 24 packages from 20 contributors in 13.517s`

run configuration:
newman run ./AA_TEST_REPORT_PORTAL.postman_collection.json -e ./search.postman_environment.json -r reportportal --reporter-reportportal-debug=true --reporter-reportportal-endpoint=https://xxx/api/v1 --reporter-reportportal-token=xxx --reporter-reportportal-launch=xxx --reporter-reportportal-project=yyy -x

the same for:
newman run ./AA_TEST_REPORT_PORTAL.postman_collection.json -e ./search.postman_environment.json -r @reportportal/reportportal --reporter-@reportportal/reportportal-debug=true --reporter-@reportportal/reportportal-endpoint=https://xxx.com/api/v1 --reporter-@reportportal/reportportal-token=xxx --reporter-@reportportal/reportportal-launch=xxx --reporter-@reportportal/reportportal-project=yyy -x

error message:
Error: Request failed with status code 400: {"error_code":4001,"message":"Incorrect Request. [Field 'startTime' shouldn't be null.] "} at C:\Users\xxx\AppData\Roaming\nvm\v13.12.0\node_modules\newman-reporter-reportportal\node_modules\reportportal-client\lib\rest.js:27:23 at processTicksAndRejections (internal/process/task_queues.js:97:5)

RP launch is not ending

Thanks guys for this RP Client.

When i tried running this with newman, the results are getting pushed to RP. But the launch is not getting completed and I am forced to "Force Finish" the launch.

This is the command I used

>newman run Profile_Settings.postman_collection.json -e Dev_Env.json -r html,cli,junit,reportportal --reporter-html-template templates/htmlreqres.hbs --reporter-html-export API_Test_Report.html --reporter-junit-export Junit_report.xml --insecure --reporter-reportportal-debug=false --reporter-reportportal-endpoint=http://my_url/api/v1 --reporter-reportportal-token=my_token--reporter-reportportal-launch=API_Test --reporter-reportportal-project=MANUALEXECUTION

I get these errors in the console log:

(node:14452) UnhandledPromiseRejectionWarning: TypeError: Cannot set property 'realId' of undefined
    at helpers.getServerResult.then (C:\Users\ajayara\AppData\Roaming\npm\node_modules\newman-reporter-reportportal\node_modules\reportportal-client\lib\report-portal-client.js:293:49)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:14452) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 22)
(node:14452) UnhandledPromiseRejectionWarning: TypeError: Cannot set property 'realId' of undefined
    at helpers.getServerResult.then (C:\Users\ajayara\AppData\Roaming\npm\node_modules\newman-reporter-reportportal\node_modules\reportportal-client\lib\report-portal-client.js:293:49)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:14452) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 23)
{ error_code: 4001,
  message: 'Incorrect Request. [Field \'name\' shouldn\'t be null.] ' }
(node:14452) UnhandledPromiseRejectionWarning: TypeError: Cannot set property 'realId' of undefined
    at helpers.getServerResult.then (C:\Users\ajayara\AppData\Roaming\npm\node_modules\newman-reporter-reportportal\node_modules\reportportal-client\lib\report-portal-client.js:293:49)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:14452) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 24)
(node:14452) UnhandledPromiseRejectionWarning: TypeError: Cannot set property 'realId' of undefined
    at helpers.getServerResult.then (C:\Users\ajayara\AppData\Roaming\npm\node_modules\newman-reporter-reportportal\node_modules\reportportal-client\lib\report-portal-client.js:293:49)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:14452) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 25)
(node:14452) UnhandledPromiseRejectionWarning: TypeError: Cannot set property 'realId' of undefined
    at helpers.getServerResult.then (C:\Users\ajayara\AppData\Roaming\npm\node_modules\newman-reporter-reportportal\node_modules\reportportal-client\lib\report-portal-client.js:293:49)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:14452) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 26)

Launches remain in progress from Postman if you have more than a single string for a name.

When running with tests in postman like this:

pm.test("StoryID:" + request.name + " Response status is 200", function () { pm.response.to.have.status(200); });

Then the launch / items remain in progress forever and no results are ever logged

image

When we switched to:

pm.test("StoryID: Response status is 200", function () { pm.response.to.have.status(200); });

Then it started working:

image

There were no logs... or helpful information to determine this problem, it took several days of trial and error to find this issue. The request.name function in Postman literally just inserts the name of the request being made. This is there to make the names of the tests unique to solve an issue with the Junit parser in Bamboo.

We have a choice of incorrect results in bamboo and it working in Report portal. Correct results in bamboo and no results in report portal, or hard coding a unique name in our test suite and both work, but we introduce bad practice. We also tried creating a unique name as a variable and then passing in the variable string to the test name... report portal didn't like that either.

Cannot deserialize instance of `java.lang.String` out of START_ARRAY token: Jackson error

newmam agent is throwing below exception for nested for complex json

\Error: Request failed with status code 400: {"errorCode":4001,"message":"Incorrect Request. Invalid JSON input: Cannot deserialize instance of java.lang.String out of START_ARRAY token; nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of java.lang.String out of START_ARRAY token\n at [Source: (PushbackInputStream); line: 1, column: 192] (through reference chain: com.epam.ta.reportportal.ws.model.StartTestItemRQ["parameters"]->java.util.ArrayList[0]->com.epam.ta.reportportal.ws.model.ParameterResource["value"])"}
at /usr/local/lib/node_modules/@reportportal/newman-reporter-agent-js-postman/node_modules/@reportportal/client-javascript/lib/rest.js:36:23

json sample:

[
{
"requests": [
{
"name": "GetOfficerDetailsByID",
"data": [
{
"officerID": "5306",
"officerNum": "AHD10"
},
{
"officerID": "5182",
"officerNum": "A B81"
},
{
"officerID": "5304",
"officerNum": "AHC00"
}
]
},
{
"name": "ObligorSearchByTIN",
"data": [
{
"TIN_Number": "202317056",
"obligorNum": "3378406459"
},
{
"TIN_Number": "221611620",
"obligorNum": "3378405568"
},
{
"TIN_Number": "382219512",
"obligorNum": "3378485578"
},
{
"TIN_Number": "271001069",
"obligorNum": "3378476544"
}
]
},
{
"name": "GetAllProcessCenters",
"data": [
{
"processCenterName1": "ALL",
"processCenterName2": "East",
"processCenterName3": "West"
}
]
}
]
}
]

Chai Bdd.

Hello we are using Chai Bdd that are assertion as below :

describe('wager --> Mandatory Elements ', () => { it('Should have property dbg ', () => {tmpWager.wager.should.have.property('dbg');}); if (played) { it('Should have property wagerId ', () => {tmpWager.should.have.property('wagerId');}); it('Should have property serialNumbers ', () => {tmpWager.should.have.property('serialNumbers');});

can we support it ?

Also my it test are stored in a function that is call using eval. i saw that this are not counted, but other report can count it .

Refused error is throwing but i am providing proper hostname

I am providing proper endpoint, still, error displaying the localhost IP and throwing connection refused error

Cmd line :
newman run test_fail.json -e Auto_QA.json -r @reportportal/agent-js-postman --reporter-@reportportal/agent-js-postman-debug=true --reporter-@reportportal/agent-js-postman-endpoint=http://xxxxxxxxxxx.com:8080/api/v1 --reporter-@reportportal/agent-js-postman-token=8f9d4d9c-xxxx-xxxx-xxxx-fe08ddc7fada --reporter-@reportportal/agent-js-postman-launch=SampleRunJai --reporter-@reportportal/agent-js-postman-project=SUPERADMIN_PERSONAL --reporter-@reportportal/agent-js-postman-description=LAUNCH_DESCRIPTION -x

Error: connect ECONNREFUSED 127.0.0.1:80
at C:\Users\xxxxxxx\AppData\Roaming\npm\node_modules@reportportal\newman-reporter-agent-js-postman\node_modules@reportportal\client-javascript\lib\rest.js:31:23
at processTicksAndRejections (internal/process/task_queues.js:93:5)
Error: connect ECONNREFUSED 127.0.0.1:80
at C:\Users\xxxxxxx\AppData\Roaming\npm\node_modules@reportportal\newman-reporter-agent-js-postman\node_modules@reportportal\client-javascript\lib\rest.js:31:23
at processTicksAndRejections (internal/process/task_queues.js:93:5)
Error: connect ECONNREFUSED 127.0.0.1:80
at C:\Users\xxxxxxx\AppData\Roaming\npm\node_modules@reportportal\newman-reporter-agent-js-postman\node_modules@reportportal\client-javascript\lib\rest.js:31:23
at processTicksAndRejections (internal/process/task_queues.js:93:5)
Error: connect ECONNREFUSED 127.0.0.1:80
at C:\Users\xxxxxxx\AppData\Roaming\npm\node_modules@reportportal\newman-reporter-agent-js-postman\node_modules@reportportal\client-javascript\lib\rest.js:31:23
at processTicksAndRejections (internal/process/task_queues.js:93:5)

Calls in Postman Collections without tests don't complete

Within out test suites we have 'setup' and 'clear up' tasks. These are often outside the boundry of the product under test, for example calling a third party solution, as such we don't 'validate' anything because we don't want our test suite to fail due to reasons outside of our test boundry.

As a result of this the item/launch remains in progress. To solve we are filling these with rubbish 'tests' that will validate the response time is less than 1 hour, however, it would be better if there are no tests that Report portal simply says "Total: 0" and does not fill in passed, failed, skipped etc and closes out the item and subsequently the launch.

Example without test:

image

image

Wrong test result publishing when Data File is used

I run the postman collection using newman and reporter - "@reportportal/newman-reporter-reportportal": "0.0.23"

I have a data file with an 11 iteration record.
When I launch my collection I see an expected output in the Newman console but the report portal shows 11 duplicated suites.

It seems that the latest test suite result is copied to everywhere (including response body).
I expect to see this kind of result
expected

But in all test suites, I see only this one (which is actually related to 3 last cases)
actual

ReportPortal doesn't parse postman tests correctly.

I have simple test (see code below):

pm.environment.set('trigger', 0)

let trigger = pm.environment.get('trigger')

if (trigger === 0) {
    pm.test("trigger is 0", function() {                
        pm.expect(trigger).to.eql(0)                
    })
}
else {
    pm.test("trigger is 1", function() {  
        pm.expect(trigger).to.eql(1)
    })
}

If I run this test in Postman or newman, it will show me correct results (1 test passed).
But if send this test in ReportPortal, it will show me incorrect results (1 test passed and 1 In Progress forever).
I've tried to use switch-case, but issue still exists.
image
image

ReportPortal reporting tests that don't run postman

On the collection 'header' we have some tests to verify response time/content type of every call, however with the ability to 'skip' on specific calls where we do not want to do this.

image

On the Setup folder, our Pre-request script says to skip both of these tests

image

When running these tests in postman ( or through build agents ) the tests are successfully skipped

image

If I add a test to one of these calls, in Report portal it starts to ignore the skip... even though the test isn't run:

image

Unable to see launches from newman run

Hi Team,
I am unable to see launches from newman run. However i can see test item start/Success/Finish as well with save log on cli.

Start launch 12tzmgrckl6ezcht
Start test item 12tzmgrckl6ezci3
Start test item 12tzmgrckl6ezd4g
Start test item 12tzmgrckl6ezdga
Start test item 12tzmgrckl6ezdtk
Start test item 12tzmgrckl6eze64
Success start item 12tzmgrckl6ezci3

Could you please help me how can i see launches in report portal ?

D:\Postman> newman run .\InternationalPaymentInitiationcollection.json --insecure --reporters @reportportal/reportportal --reporter-@reportportal/reportportal-debug=true --reporter-@reportportal/reportportal-endpoint=http://10.192 .XX.1XX:8080 --reporter-@reportportal/reportportal-token=167ebff4-276f-47ba-bd6f-bxxxx92544075 --reporter-@reportportal/reportportal-launch=POSTMAN_TEST_PRAVIN --reporter-@reportportal/reportportal-project=test-automation -x

Start launch 12tzmgrckl6ezcht
Start test item 12tzmgrckl6ezci3
Start test item 12tzmgrckl6ezd4g
Start test item 12tzmgrckl6ezdga
Start test item 12tzmgrckl6ezdtk
Start test item 12tzmgrckl6eze64
Success start item 12tzmgrckl6ezci3

using agent-js-postman in a docker container does not allow launch to end

Hey everyone!

I appreciate whoever is taking a look at this bug issue within github. I will try to describe the issue as best I can.

I managed to get agent-js-postman to work locally as expected in a local windows jenkins instance where it finishes with

Finish launch cq3o6sokw12fq70
Success finish launch cq3o6sokw12fq70

This is exactly what I want to see and the launch appears as expected within report portal.

After I saw it was working as I wanted to locally without Docker, I decided to build a docker image with agent-js-postman since that is currently how all if not most of our automation is executed today. Once I built the image and got it working, I ran the exact same automation that I did locally but from within docker and a non-local jenkins instance.

Instead of eventually seeing a "finish launch" and "success finish launch", the last lines in the console output in jenkins are:

Finish test item 40599u1kw2eb6sz
Success finish item 40599u1kw2eb6t0
Success finish item 40599u1kw2eb6sw
Success finish item 40599u1kw2eb6sr
Success finish item 40599u1kw2eb6st
Success finish item 40599u1kw2eb6su
Success finish item 40599u1kw2eb6sy
Success finish item 40599u1kw2eb6sv
Success finish item 40599u1kw2eb6sz
Success finish item 40599u1kw2eb6ss
Success finish item 40599u1kw2eb6sx

Which you can see does not include the "finish launch" or "success finish launch" which seems to be what report portal is looking for to determine when a launch is finished. Additionally, pressing force finish from the UI is not a workaround as it appears the job finishes before the automation itself is actually complete, which means I end up missing a decent amount of tests that I would need to include if I were reporting on these results.

Are there any suggestions or things that I could try to have both my local instance of jenkins without docker and the non-local jenkins instance with Docker finish with the exact same results?

Please let me know what information I can provide to help with this issue. Thanks so much!

Newman script fails to run with reportportal

Using the following options Newman collection fails to run, an exception is throw at the getTags method

newman run -r htmlextra,reportportal Smoke_Testing.postman_collection.json -e Swagger_Stage.post
man_environment.json --reporter-html-export --delay-request 5000 --reporter-reportportal-debug=true --reporter-reportpor
tal-endpoint=http://x.xx.xxx.xxx:8080/api/v1 --reporter-reportportal-token=xxxxx-xxxx-xxxx-xxxx --report
er-reportportal-launch=TEST_EXAMPLE --reporter-reportportal-project=project -x

Start launch g2pc9d9ojyof0zp7
Start test item g2pc9d9ojyof0zpi
Success start item g2pc9d9ojyof0zpi
C:\Users\Tony\AppData\Roaming\npm\node_modules\newman-reporter-reportportal\lib\index.js:179
throw err;
^

TypeError: Cannot read property 'split' of null
at getTags (C:\Users\Tony\AppData\Roaming\npm\node_modules\newman-reporter-reportportal\lib\index.js:365:34)
at _.filter.flatMap.flatMap.forEach.stepName (C:\Users\Tony\AppData\Roaming\npm\node_modules\newman-reporter-reportportal\lib\index.js:147:27)
at Array.forEach ()
at EventEmitter.emitter.on (C:\Users\Tony\AppData\Roaming\npm\node_modules\newman-reporter-reportportal\lib\index.js:142:14)
at EventEmitter.emit (C:\Users\Tony\AppData\Roaming\npm\node_modules\newman\node_modules\eventemitter3\index.js:203:33)
at Function.callbacks.(anonymous function) [as beforeTest] (C:\Users\Tony\AppData\Roaming\npm\node_modules\newman\lib\run\index.js:194:34)
at PostmanCollectionRun.event (C:\Users\Tony\AppData\Roaming\npm\node_modules\newman\node_modules\postman-runtime\lib\runner\extensions\event.command.js:216:62)
at Instruction.execute (C:\Users\Tony\AppData\Roaming\npm\node_modules\newman\node_modules\postman-runtime\lib\runner\instruction.js:159:29)
at PostmanCollectionRun._process (C:\Users\Tony\AppData\Roaming\npm\node_modules\newman\node_modules\postman-runtime\lib\runner\run.js:168:21)
at PostmanCollectionRun. (C:\Users\Tony\AppData\Roaming\npm\node_modules\newman\node_modules\postman-runtime\lib\runner\run.js:169:76)
at ontimeout (timers.js:436:11)
at tryOnTimeout (timers.js:300:5)
at listOnTimeout (timers.js:263:5)
at Timer.processTimers (timers.js:223:10)

Error when trying the sample CLI & snipt

Hello,

I ran into a problem when trying the sample from the project tutorial:

The error msg:
image

The versions:
npm list -g | grep new
├─┬ @reportportal/[email protected]
│ │ │ │ │ └── [email protected]
│ │ │ │ └── [email protected] deduped
│ │ └── [email protected]
├─┬ [email protected]
├─┬ [email protected]
├── [email protected]

image

The .js I am using:

`module.paths.push('/usr/local/lib/node_modules');
const newman = require("newman");

newman.run(
{
collection: "https://postman-echo.com/status/200",
reporters: "@reportportal/agent-js-postman",
reporter: {
"@reportportal/agent-js-postman": {
endpoint: "http://192.168.0.14:8090/api/v1",
token: "f23d8b4e-2a8a-490e-a4f3-7b2bb2dffe06",
launch: "zp_api",
project: "dev",
description: "LAUNCH_DESCRIPTION",
attributes: [
{
"key": "launchKey",
"value": "launchValue"
},
],
mode: 'DEFAULT',
debug: true
}
}
},
function(err) {
if (err) {
throw err;
}
console.log("collection run complete!");
}
);`

Thanks for the help.

[Issue] Tests with conditions lead to infinite run

Tools:

  • Postman + Newman

If the test has conditions and the condition is false (we don't execute pm.test() {} in the condition block), I see the test in the report and it will never end.

Example:

let jsonData = JSON.parse(responseBody);

for (let i = 0; i < jsonData.data.length; i++) {
    let id = jsonData.data[i].id;

    pm.test("event id != null", function () {
        pm.expect(jsonData.data[i].id).to.not.eql(null);
    });

    let event_type = jsonData.data[i].attributes.type;

    if (event_type === "event") {
        pm.test("event type === null", function () {
            pm.expect(jsonData.data[i].relationships.event_type).to.eql(null);
        });
    }
}

Need to pass auth header and having issues

Hello - currently trying to use reportportal via CLI and I need a way to pass an auth header. I did not see headers as a specific option for newman and report portal so was attempting to use restClientConfig like this:

newman run {{myPostmanUrl}} --folder '$(area)' --reporter-htmlextra-darkTheme --reporter-htmlextra-logs --reporter-htmlextra-testPaging --reporter-htmlextra-omitHeaders --reporter-htmlextra-noSyntaxHighlighting --reporter-htmlextra-title {{myTitle}} -r htmlextra,testrail,@reportportal/agent-js-postman --timeout-script 4000000 -n 1 -e {{myPostmanEnv}}
--reporter-@reportportal/agent-js-postman-debug=true
--reporter-@reportportal/agent-js-postman-endpoint={{myReportPortalUrl}}
--reporter-@reportportal/agent-js-postman-token={{reportPortalToken}}
--reporter-@reportportal/agent-js-postman-launch={{myLaunchName}}
--reporter-@reportportal/agent-js-postman-project={{reportPortalProject}}
--reporter-@reportportal/agent-s-postman-description={{testDescription}}
--reporter-@reportportal/agent-js-postman-restClientConfig="{rejectUnauthorized:false,params: {access_token: 'XXXX'},headers: { Authorization: 'Basic XXXXX }}" \

When I try this I get a 401 from Report Portal but I know my credentials are correct. Any ideas?

npm install not working

npm install -g newman-reporter-reportportal

npm ERR! code E404

npm ERR! 404 Not Found: newman-reporter-reportportal@latest

Unable to submit attributes for launch with agent for newman

Hi guys,
CLI for newman to upload launch is as follow, but i cannot set attributes for the launch.
Could you help to support it? Or is there any way i could set attributes for the uploaded launch?
$ 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

Subfolders missing in the Report Portal hierarchy

Hi Team,

Integration of Postman Newman with report portal is successful with this package, but has an issue with the hierarchy.

My collections are in the below structure:

image

Expected hierarchy in Report Portal after Integration:

Report Portal Launch name with the exact structure of collection under it.

image

Actual hierarchy what we are seeing after Integration:

Report Portal Launch name followed by collection name and all the tests from subfolders directly listed under it.

image

Hi @AmsterGet @chivekrodis Can you please provide your inputs on this? Is this a bug or am I missing something here?

Request failed with status code 400 , using the latest version 5.0.2 newman-reporter-agent-js-postman

newman run https://postman-echo.com/status/200
-r @reportportal/agent-js-postman
--reporter-@reportportal/agent-js-postman-debug=true
--reporter-@reportportal/agent-js-postman-endpoint=https://reportportal.xxx.com/api/v1
--reporter-@reportportal/agent-js-postman-token=xxxxxxxx-xxxxxxxx-xxxxxxxxxxx
--reporter-@reportportal/agent-js-postman-launch=superadmin_TEST_EXAMPLE
--reporter-@reportportal/agent-js-postman-project=lit-api
--reporter-@reportportal/agent-js-postman-description=TEST_LAUNCH
-x
Start launch sktwim4akrgtkbvj
Start test item sktwim4akrgtkc0o
Error start item sktwim4akrgtkc0o:
Error: Request failed with status code 400: {"errorCode":4001,"message":"Incorrect Request. [Field 'name' should not be null.] "}
at /usr/local/lib/node_modules/@reportportal/newman-reporter-agent-js-postman/node_modules/@reportportal/client-javascript/lib/rest.js:36:23
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Error: Request failed with status code 400: {"errorCode":4001,"message":"Incorrect Request. [Field 'name' should not be null.] "}
at /usr/local/lib/node_modules/@reportportal/newman-reporter-agent-js-postman/node_modules/@reportportal/client-javascript/lib/rest.js:36:23
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Error: Request failed with status code 400: {"errorCode":4001,"message":"Incorrect Request. [Field 'name' should not be null.] "}
at /usr/local/lib/node_modules/@reportportal/newman-reporter-agent-js-postman/node_modules/@reportportal/client-javascript/lib/rest.js:36:23
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Error: Request failed with status code 400: {"errorCode":4001,"message":"Incorrect Request. [Field 'name' should not be null.] "}
at /usr/local/lib/node_modules/@reportportal/newman-reporter-agent-js-postman/node_modules/@reportportal/client-javascript/lib/rest.js:36:23
at processTicksAndRejections (node:internal/process/task_queues:96:5)

"reportportal" reporter could not be loaded

Installed newman
Installed newman-reporter-reportportal
Ran from a nodejs script just like in the documentation
Get this error:
newman: "reportportal" reporter could not be loaded. please install reporter using npm

Tried uninstalling and installing packages again, no change
Tries installing packages on a global level, no change

Any insight?

Template strings eg. backticks not supported

If Postman test uses template strings like shown below, then these are not parsed correctly because regex used for detecting tests does not take backticks into account.

pm.test(`Should include ${sectorName} in the records list`, function () {
	  const countries = pm.response.json().success.data.countries;
	  const countryUS = countries.find
	    (data => data.name === "United States");
	  const responseSector = countryUS.sectors.find
	    (data => data.name === sectorName);
	  pm.expect(responseSector.name).to.eql(sectorName)
});

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.