Newman API Tests #31
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Newman API Tests | |
| on: | |
| push: | |
| branches: [main, master] | |
| pull_request: | |
| branches: [main, master] | |
| schedule: | |
| - cron: "0 0 * * *" | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| environment: ["Dev", "QA", "Staging"] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| - name: Install Newman | |
| run: | | |
| npm install -g newman | |
| npm install -g newman-reporter-htmlextra | |
| - name: Run Newman Tests - ${{ matrix.environment }} | |
| run: | | |
| newman run collections/JSONPlaceholder_API_Tests.postman_collection.json \ | |
| -e environments/JSONPlaceholder-${{ matrix.environment }}.postman_environment.json \ | |
| -r cli | |
| continue-on-error: false | |
| - name: Generate HTML Report | |
| if: always() | |
| run: | | |
| newman run collections/JSONPlaceholder_API_Tests.postman_collection.json \ | |
| -e environments/JSONPlaceholder-${{ matrix.environment }}.postman_environment.json \ | |
| -r htmlextra \ | |
| --reporter-htmlextra-export newman-report-${{ matrix.environment }}.html | |
| - name: Upload HTML Report | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: newman-report-${{ matrix.environment }} | |
| path: newman-report-${{ matrix.environment }}.html |