Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahbub091 committed Sep 6, 2023
1 parent fd508ac commit 63cb0c2
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 31 deletions.
60 changes: 29 additions & 31 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
15 changes: 15 additions & 0 deletions collections/Test.postman_environment.json
Original file line number Diff line number Diff line change
@@ -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"
}
1 change: 1 addition & 0 deletions report.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 63cb0c2

Please sign in to comment.