Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reporter is unable to find tests for the call that resulted in 500 #409

Closed
1 task done
avostretsov opened this issue May 9, 2023 · 8 comments
Closed
1 task done
Labels
state: triaged This issue has been triaged

Comments

@avostretsov
Copy link

Is There An Existing Issue

What Are You Seeing

When request results in 500, reporter is unable to find tests for this call and gives false positive result.
Screen Shot 2023-05-09 at 11 11 59 AM
Screen Shot 2023-05-09 at 11 11 30 AM

Steps To Reproduce The Issue

  1. Run newman from the command line using postman collection you know would have one of the calls result in 500 (use mock server if needed).
  2. From browser open html extra report > Total Requests tab > click on the call that resulted in 500

Expected: Tests for the call should have been executed

Actual: NO TESTS FOR THIS REQUEST - see screenshot attached

Full Newman Command Or Node Script

./node_modules/newman/bin/newman.js run https://api.postman.com/collections/15351868-40bd488b-2524-4280-91c3-b501d5db5ad4?access_key=XXXXXXX -d secrets-stage.json --env-var strive_host=https://api.uat.gpn.strivegaming.dev --env-var strive_base_path=/api/v1 --env-var rgs_host=https://rgs.stage.bspot.com --env-var rgs_base_path=/rgs/api/v1 --env-var rgs_game_base_path=/gapi/api/v1.3 --env-var baseUrl=https://d8dc28cd-10d3-40b9-a44c-173c528f2df5.mock.pstmn.io -r htmlextra,cli

HTMLEXTRA Version

1.22.11

Newman Version

5.3.2

Additional Context

No response

@avostretsov avostretsov added state: needs-triage This issue needs to be triaged type: bug Something isn't working labels May 9, 2023
@github-actions
Copy link

github-actions bot commented May 9, 2023

Hey @avostretsov: 👋 - Thanks for helping to make the reporter better by raising this ticket. I will take a look as soon as I can and get back to you. Cheers, Danny.

@avostretsov
Copy link
Author

For comparison, I am attaching a screenshot of the true positive test result for the same call when status is not 500
Screen Shot 2023-05-10 at 10 42 40 AM

@DannyDainton
Copy link
Owner

DannyDainton commented May 11, 2023

Hey @avostretsov,

Do you have the cli console output for that 500 request? Can you recreate it consistently?

I've tried with a basic GET https://postman-echo.com/status/500 using the Postman Echo service - I can see tests being run as part of this 500 Status Code request.

Screenshot 2023-05-11 at 15 13 54
Screenshot 2023-05-11 at 15 14 16

I'm unsure what that request returned on your side so I can't really do much to be honest, the reporter just spits out what Newman feeds it so if there was an issue with the data at that point, it wouldn't have come through to the final HTML report.

The only thing that I can think of, that might cause that output, is if you had added the tests but didn't save the request before running the Collection with the Postman API. The changes may not have been sync at that point so i might look like there are no tests for the request.

@DannyDainton DannyDainton added state: need-more-info Unable to reproduce/understand the issue state: triaged This issue has been triaged and removed state: needs-triage This issue needs to be triaged labels May 11, 2023
@avostretsov
Copy link
Author

avostretsov commented May 11, 2023

I found my problem which is in the first two lines of the test.
Since the call was unsuccessful, location var is undefined. Postman then goes to the next line and performs split() method on undefined which triggers an error in the log: "TypeError: Cannot read properties of undefined (reading 'split')".
Postman then bails out from the tests of this call. So, no tests were executed below the second line which resulted in the false positive.
Moving call's status assertion to the top fixes my issue.

I have couple of suggestions.

  1. Is it possible for tests to still be executed if there are errors like mine?
  2. Would it make more sense to neutrally color-code requests with no or ignored tests, say grey?

@DannyDainton
Copy link
Owner

It's nothing really that the reporter, this one or other ones, can do about that situation.

If the data isn't in the Newman Summary Object at the end of the run, I can't show anything. So if it's telling me there are no tests, that's all I can show.

There could be a million and one reasons why that might be the case but I can't write logic to cover them all 😅

I'm not sure I understand what you mean by point 2, can you provide an visual example and expand on how that situation might occur.

@DannyDainton DannyDainton removed type: bug Something isn't working state: need-more-info Unable to reproduce/understand the issue labels May 11, 2023
@avostretsov
Copy link
Author

For point 1, I understand that this is not a reporter issue. I guess what I meant was that it could be useful to bring this issue up to the postman dev team so they can consider addressing it.

For point 2 - requests with failed tests under Total Requests are color-coded with Red and all other requests - with Green. I am trying to make a point that having requests with no tests marked Green can be misleading. Neutral color like grey would make more sense.

@DannyDainton
Copy link
Owner

Free free to raise an issue on the public tracker for the team to triage and set a priority against. It's not something I'll be handling. I like to keep this reporter separate to my other work.

A request doesn't need a test within it to be 'good' or 'bad' so changing the colour wouldn't be something I'll be doing. The report is only a template file which can be copied and the colour can be change by anyone using the reporter. You could basically do anything you like and present the data in the way that suits your own usecase.

I'm going to close this issue and it isn't really a bug with the reporter and more on the Postman/Newman side of things.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
state: triaged This issue has been triaged
Projects
None yet
Development

No branches or pull requests

2 participants