postmanlabs / newman

Newman is a command-line collection runner for Postman
https://www.postman.com
Apache License 2.0
6.88k stars 1.16k forks source link

HTML report not getting created when using Postman through docker image #1522

Closed Narendra-WAL closed 6 years ago

Narendra-WAL commented 6 years ago
  1. Newman Version (can be found via newman -v):
  2. OS details (type, version, and architecture):
  3. Are you using Newman as a library, or via the CLI?
  4. Did you encounter this recently, or has this bug always been there:
  5. Expected behaviour:
  6. Command / script used to run Newman:
  7. Sample collection, and auxiliary files (minus the sensitive details):
  8. Screenshots (if applicable):

Issue: HTML report not getting created when using Postman through docker image, when any tests fail. However the same command is working properly when using my mac with version 3.8.3.

  1. Postman docker image - https://hub.docker.com/r/postman/newman_ubuntu1404/ Postman version in the docker image - 3.9.2
  2. Platform - CircleCI - Ubuntu
  3. CLI -> CI using command. This issue has been there since many months.
  4. Report should get created even if the tests fail. Report contain information about the failures.
  5. Command: newman run --reporters html api_tests/Fennel.postman_collection.json --environment api_tests/Fennel.postman_environment.json -x

Steps:

  1. Run newman with the given docker image and given command with HTML report, collection and environment.
  2. Add wrong tests. (HTML report is getting created when all tests succeed)
  3. At the end I am getting error 'Cannot read toString of undefined'. If I don't add -x to the command then it will exit with code 1.
  4. Finally the report is not available.

logsend

Narendra-WAL commented 6 years ago

This has been in the same state since quite some time. Please let me know if you need any help in investigating this.

kunagpal commented 6 years ago

@Narendra-WAL Reports are exported to the mounted directory by default:

#!/usr/bin/env bash
set -e; # Bail out on the first error

# The SOURCE_DIR and REPORT_FILE environment variables have to be set
docker run -v "${SOURCE_DIR}:/etc/newman" -t ${IMAGE} run sample-collection.json -r html,cli --reporter-html-export ${REPORT_FILE};

Once the above run has completed, the file indicated by $REPORT_FILE will be present in $SOURCE_DIR outside your Docker container.