name: Test-Build
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
test-api:
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
# INstall Node on the runner
- name: Install Node
uses: actions/setup-node@v1
with:
node-version: '21.x'
# Install the newman command line utility and also install the html extra reporter
- name: Install newman
run: |
npm install -g newman
npm install -g newman-reporter-htmlextra
# Make directory to upload the test results
- name: Make Directory for results
run: mkdir -p testResults
# Run the POSTMAN collection
- name: Run POSTMAN collection
run: |
newman run ./Sanity/Sanity.postman_collection.json -e ./environments/integration.postman_environment.json -r htmlextra --reporter-htmlextra-export testResults/htmlreport.html --reporter-htmlextra-darkTheme > testResults/runreport1.html
# Upload the contents of Test Results directory to workspace
- name: Output the run Details
uses: actions/upload-artifact@v2
with:
name: RunReports
path: testResults
if-no-files-found: warn
Please advise what is missing also i can see the newman report like it is in CLI
This looks like a GitHub Action Yaml file. Is this correct? Can you share more context regarding what you’re trying to achieve exactly? Are you trying to run a collection in Newman on the CI while still being able to see the report printed on the CLI?
hi,
yes I am running git hub action with Newman and I can see the report, but when I am adding workflow_dispatch to pass parameters to the environment, the job is falling, please advise what is wrong.
Current yamel:
name: Test-Build
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
test-api:
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
# INstall Node on the runner
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: '20.x'
# Install the newman command line utility and also install the html extra reporter
- name: Install newman
run: |
npm install -g newman
npm install -g newman-reporter-htmlextra
# Make directory to upload the test results
- name: Make Directory for results
run: mkdir -p testResults
# Run the POSTMAN collection
- name: Run POSTMAN collection
run: |
newman run ./Sanity/Sanity.postman_collection.json -e ./environments/integration.postman_environment.json -r htmlextra --reporter-htmlextra-export testResults/htmlreport.html --reporter-htmlextra-darkTheme
- name: Publish Report
uses: actions/upload-artifact@v2
with:
name: RunReports
path: testResults