newman-cicd-integration – skill Lập trình cho agent AI
Tạo cấu hình pipeline CI/CD sẵn sàng sử dụng, cài đặt và chạy Newman để kiểm thử API tự động.
Cài skill newman-cicd-integration bằng một lệnh
Chọn công cụ bạn đang dùng, copy lệnh và dán vào terminal. Skill sẽ nằm trong thư mục skills của công cụ đó và sẵn sàng dùng ở phiên làm việc tiếp theo.
Claude Code
mkdir -p ~/.claude/skills && curl -fsSL https://skill.dn1nguoi.com/z/newman-cicd-integration-712ad.tgz | tar xz -C ~/.claude/skills
Gọi trong Claude Code: /newman-cicd-integration – rồi mô tả công việc bạn muốn làm.
Codex
mkdir -p ~/.codex/skills && curl -fsSL https://skill.dn1nguoi.com/z/newman-cicd-integration-712ad.tgz | tar xz -C ~/.codex/skills
Gọi trong Codex: $newman-cicd-integration – rồi mô tả công việc bạn muốn làm.
Hermes Agent
mkdir -p ~/.hermes/skills && curl -fsSL https://skill.dn1nguoi.com/z/newman-cicd-integration-712ad.tgz | tar xz -C ~/.hermes/skills
Gọi trong Hermes Agent: /newman-cicd-integration – rồi mô tả công việc bạn muốn làm.
DeepSeek
mkdir -p ~/.deepcode/skills && curl -fsSL https://skill.dn1nguoi.com/z/newman-cicd-integration-712ad.tgz | tar xz -C ~/.deepcode/skills
Gọi trong DeepSeek: /newman-cicd-integration – rồi mô tả công việc bạn muốn làm.
Nội dung SKILL.md
Nội dung SKILL.md gốc bằng tiếng Anh.
Newman CI/CD Integration Generator
When to Use
Use this skill when you need generate ready-to-use CI/CD pipeline configurations that install and run Newman for automated API testing. Use this skill whenever the user wants to run Newman in a CI pipeline, integrate Postman collections into automated builds, set up API tests in GitHub Actions, GitLab CI, Jenkins,...
Generate complete, copy-paste-ready CI/CD pipeline configs that install Newman and run Postman collections as part of automated builds.
---
What to Collect From the User
Before generating a config, determine:
1. CI platform — GitHub Actions, GitLab CI, Jenkins, Azure DevOps, CircleCI, Bitbucket?
2. Collection source — local file in repo, or Postman API URL?
3. Environment — local env file in repo, or env vars injected by CI secrets?
4. Reporters needed — JUnit XML (for CI test results panel), HTML report, or both?
5. Node.js version preference (choose a currently supported version compatible with Newman)
6. Trigger — on every push, pull request, schedule, or after deploy?
7. Fail build on test failure? — almost always yes; confirm
---
CI trust and credential handling
Review collection scripts and target URLs before executing: Postman scripts and requests can exfiltrate secrets or mutate services. Run only authorized sandbox collections; never expose production credentials to untrusted pull requests. Pin dependencies/actions using the project’s reviewed lockfile/commit policy instead of copying moving global installs unchanged. OS environment variables do not automatically populate Postman variables: supply a protected temporary environment JSON via -e or an explicitly reviewed runner integration. Avoid real secret command arguments, shell tracing and request/response-rich public HTML artifacts; redact reports, restrict access/retention and remove temporary secrets. Required test failures must remain failures.
Platform Templates
GitHub Actions
name: API Tests
on:
push:
branches: [main, develop]
pull_request:
jobs:
api-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Install Newman
run: |
npm install -g newman
npm install -g newman-reporter-htmlextra
- name: Run API tests
run: |
newman run ./collections/my-api.json \
-e ./environments/staging.json \
-r cli,junit,htmlextra \
--reporter-junit-export ./results/junit.xml \
--reporter-htmlextra-export ./results/report.html \
--reporter-htmlextra-title "API Test Results"
env:
BASE_URL: ${{ secrets.BASE_URL }}
API_KEY: ${{ secrets.API_KEY }}
- name: Publish test results
uses: dorny/test-reporter@v1
if: always()
with:
name: Newman API Tests
path: results/junit.xml
reporter: java-junit
- name: Upload HTML report
uses: actions/upload-artifact@v4
if: always()
with:
name: api-test-report
path: results/report.html---
GitLab CI
stages:
- test
api-tests:
stage: test
image: node:22-alpine
before_script:
- npm install -g newman newman-reporter-htmlextra
script:
- |
newman run ./collections/my-api.json \
-e ./environments/staging.json \
--env-var "BASE_URL=$BASE_URL" \
-r cli,junit,htmlextra \
--reporter-junit-export results/junit.xml \
--reporter-htmlextra-export results/report.html
artifacts:
when: always
reports:
junit: results/junit.xml
paths:
- results/report.html
expire_in: 7 days
variables:
BASE_URL: $BASE_URL # Set in GitLab CI/CD > Variables
API_KEY: $API_KEY---
Jenkins (Declarative Pipeline)
pipeline {
agent any
tools {
nodejs 'NodeJS-22' // Configure in Global Tool Configuration
}
stages {
stage('Install Newman') {
steps {
sh 'npm install -g newman newman-reporter-htmlextra'
}
}
stage('Run API Tests') {
steps {
sh '''
newman run ./collections/my-api.json \
-e ./environments/staging.json \
-r cli,junit,htmlextra \
--reporter-junit-export results/junit.xml \
--reporter-htmlextra-export results/report.html \
--reporter-htmlextra-title "API Tests - ${BUILD_NUMBER}"
'''
}
}
}
post {
always {
junit 'results/junit.xml'
publishHTML([
allowMissing: false,
alwaysLinkToLastBuild: true,
keepAll: true,
reportDir: 'results',
reportFiles: 'report.html',
reportName: 'Newman API Test Report'
])
}
}
}---
Azure DevOps
trigger:
branches:
include:
- main
pool:
vmImage: 'ubuntu-latest'
steps:
- task: NodeTool@0
inputs:
versionSpec: '22.x'
displayName: 'Set up Node.js'
- script: |
npm install -g newman newman-reporter-htmlextra
displayName: 'Install Newman'
- script: |
newman run ./collections/my-api.json \
-e ./environments/staging.json \
-r cli,junit,htmlextra \
--reporter-junit-export $(System.DefaultWorkingDirectory)/results/junit.xml \
--reporter-htmlextra-export $(System.DefaultWorkingDirectory)/results/report.html
displayName: 'Run API Tests'
env:
API_KEY: $(API_KEY) # Set in Pipeline > Variables
- task: PublishTestResults@2
condition: always()
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: 'results/junit.xml'
testRunTitle: 'Newman API Tests'
- task: PublishBuildArtifacts@1
condition: always()
inputs:
PathtoPublish: 'results/report.html'
ArtifactName: 'api-test-report'---
CircleCI
version: 2.1
jobs:
api-tests:
docker:
- image: cimg/node:22.0
steps:
- checkout
- run:
name: Install Newman
command: npm install -g newman newman-reporter-htmlextra
- run:
name: Run API Tests
command: |
mkdir -p results
newman run ./collections/my-api.json \
-e ./environments/staging.json \
-r cli,junit,htmlextra \
--reporter-junit-export results/junit.xml \
--reporter-htmlextra-export results/report.html
- store_test_results:
path: results
- store_artifacts:
path: results/report.html
workflows:
test:
jobs:
- api-tests---
Best Practices
Secrets — never hardcode credentials
Always inject sensitive values as CI environment variables/secrets:
- GitHub:
Settings > Secrets and Variables > Actions - GitLab:
Settings > CI/CD > Variables - Jenkins:
Manage Jenkins > Credentials - Azure DevOps:
Pipelines > Variables
Materialize a protected temporary Newman environment file using a trusted secret provider, then pass only its path with -e. Do not put actual secret values in --env-var process arguments. The examples assume that protected file has been prepared; remove it after the job and redact reports.
Store collection and environment files in the repo
/
├── collections/
│ └── my-api.json
├── environments/
│ ├── staging.json
│ └── prod.json
└── results/ ← gitignored, created by NewmanAdd results/ to .gitignore.
Always use if: always() / when: always
Ensure test result artifacts are published even when Newman exits with a failure code.
Exit codes
Newman exits with code 1 if any tests fail — this automatically fails the pipeline step. Use --bail if you want to stop on the first failure rather than running all tests.
---
How to Generate Configs
1. Confirm the CI platform and tailor the exact syntax
2. Use the correct secret/variable injection syntax for that platform
3. Include artifact publishing steps so test results appear in the CI UI
4. Add comments explaining secrets that need to be configured
5. Keep environment files in the repo (without secrets); inject sensitive values via CI vars
---
After Completing the Newman CICD output
Once the Newman CICD output is delivered, ask the user:
"Would you like me to generate Postman Test Cases for these commands? (yes/no)"
If the user says yes:
- Check if the postman-testcase-generator skill is available in the installed skills list
- If the skill is available:
- Read and follow the instructions in the postman-testcase-generator skill
- Use the CICD command output above as the input
- If the skill is NOT available:
- Inform the user: "It looks like the postman-testcase-generator skill isn't installed.
You can install it and re-run.
If the user says
… (nội dung đầy đủ có trong gói tải về)
Skill liên quan
- nextjs-app-router-patterns – Các mẫu toàn diện cho kiến trúc App Router của Next.js 14+, Server Components và phát…
- nodejs-backend-patterns – Hướng dẫn toàn diện xây dựng ứng dụng backend Node.js có khả năng mở rộng, dễ bảo trì và…
- nodejs-best-practices – Nguyên tắc phát triển và ra quyết định với Node.js. Lựa chọn framework, mẫu async, bảo…
- observability-and-instrumentation – Gắn công cụ đo lường vào code để hành vi production có thể quan sát và chẩn đoán. Dùng…
- obsidian-cli – Dùng Obsidian CLI để đọc, tạo, tìm kiếm và quản lý nội dung vault, hoặc phát triển và gỡ…
- odoo-automated-tests – Viết và chạy kiểm thử tự động cho Odoo bằng TransactionCase, HttpCase và browser tour…
- odoo-migration-helper – Hướng dẫn từng bước di chuyển module tùy chỉnh Odoo giữa các phiên bản…
- odoo-module-developer – Hướng dẫn chuyên sâu tạo module Odoo tùy chỉnh. Bao gồm __manifest__.py, kế thừa model…