From 63cb0c2e2ccd08b4df8de5820318da49a42b9a79 Mon Sep 17 00:00:00 2001 From: "Md. Mahbubur Rahman" Date: Wed, 6 Sep 2023 23:34:08 +0600 Subject: [PATCH] update --- .github/workflows/main.yml | 60 +++++++++++------------ collections/Test.postman_environment.json | 15 ++++++ report.js | 1 + 3 files changed, 45 insertions(+), 31 deletions(-) create mode 100644 collections/Test.postman_environment.json diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6e0f2fe..58a7680 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -4,10 +4,10 @@ name: Newman CLI Tests Execution on: # Triggers the workflow on push or pull request events but only for the "main" branch push: - branches: - - master + branches: + - master pull_request: - branches: [ "master" ] + branches: ["master"] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -17,33 +17,31 @@ jobs: test_api_collection: runs-on: ubuntu-latest steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v3.3.0 - - - # INstall Node on the runner - - name: Install Node - uses: actions/setup-node@v3.6.0 - with: - node-version: '16.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 + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v3.3.0 + # INstall Node on the runner + - name: Install Node + uses: actions/setup-node@v3.6.0 + with: + node-version: "16.x" - # Run the POSTMAN collection - - name: Run Sample Postman Collections - run: | - newman run collections/postman_collection.json --reporters cli,htmlextra --reporter-htmlextra-export TestResults/HtmlReport.html - # Upload the contents of Test Results directory to workspace - - name: Output the run details - uses: actions/upload-artifact@v3.1.2 - with: - name: Test Results - path: TestResults + # 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 Sample Postman Collections + run: | + newman run collections/postman_collection.json -e collections/Test.postman_environment.json --reporters cli,htmlextra --reporter-htmlextra-export TestResults/HtmlReport.html + # Upload the contents of Test Results directory to workspace + - name: Output the run details + uses: actions/upload-artifact@v3.1.2 + with: + name: Test Results + path: TestResults diff --git a/collections/Test.postman_environment.json b/collections/Test.postman_environment.json new file mode 100644 index 0000000..37ac26c --- /dev/null +++ b/collections/Test.postman_environment.json @@ -0,0 +1,15 @@ +{ + "id": "1ef98c2d-1595-4277-9960-70160dd8f334", + "name": "Test", + "values": [ + { + "key": "asif", + "value": "asif", + "type": "secret", + "enabled": true + } + ], + "_postman_variable_scope": "environment", + "_postman_exported_at": "2023-09-06T17:27:42.291Z", + "_postman_exported_using": "Postman/10.17.8-230905-0807" +} \ No newline at end of file diff --git a/report.js b/report.js index 7e287e0..54517ec 100644 --- a/report.js +++ b/report.js @@ -3,6 +3,7 @@ const newman = require("newman"); newman.run( { collection: require("./collections/AutomationExerciseNew.postman_collection.json"), + environment: require("./collections/Test.postman_environment.json"), iterationCount: 1, reporters: "htmlextra",