Your question may already have an answer on the community forum. Please search for related topics, and then read through the guidelines before creating a new topic.
Here’s an outline with best practices for making your inquiry.
My question:
I’ve recently started using newman to execute API tests since Postman CLI doesn’t generate an HTML report. While testing locally using the ‘newman run’ command, I’m able to generate the HTML report. However, when running the command on GitHub CI/CD, the file isn’t being generated and I’m not receiving much error information other than:
“Run newman run ‘Postman Collections/APICollection.json’ --globals ‘Postman Collections/workspace.postman_globals.json’ -r htmlextra --reporter-htmlextra-export htmlreport.html
newman run ‘Postman Collections/APICollection.json’ --globals ‘Postman Collections/workspace.postman_globals.json’ -r htmlextra --reporter-htmlextra-export htmlreport.html
shell: /usr/bin/bash -e {0}
Error: Process completed with exit code 1.”
I’m uncertain as to what the issue is. The API tests appear to be running correctly, but the report generation isn’t working. Can you please confirm if the newman command I’m using is correct? I’ve provided the GitHub path below.
Details (like screenshots):
Github Repo Structure
r-postman-collection/
├── .github (Folder)
── workflows (under .github)
── schedule.yml (under workflows)
├── Postman Collections (Folder)
── APICollection.json (under Postman Collections)
── workspace.postman_globals.json (under Postman Collections)
YML File
name: Newman API Tests
on:
workflow_dispatch:
jobs:
test:
defaults:
run:
working-directory: ./tests
environment: staging
name: "Run tests"
runs-on: ubuntu-latest
steps:
-
uses: actions/checkout@v2
-
uses: actions/setup-node@v2
with:
node-version: "18"
-
name: "Install newman"
run: "npm install -g newman"
-
name: "Install newman reporter"
run: "npm install -g newman-reporter-htmlextra"
-
name: "Run tests"
run: "newman run NewmanDemo.postman_collection.json -e ReqResDev.postman_environment.json
-r htmlextra"
- name: Publish report
uses: MeilCli/slack-upload-file@v1
with:
slack_token: ${{ secrets.SLACK_TOKEN }}
file_path: './tests/htmlreport.html'
file_name: 'postmanReport.html'
file_type: 'html'
channels: 'api-test-reports'