本文へスキップ
Skillpedia
デプロイとクラウド(DevOps)48k · #5477

postman-newman-automation

できること

このツールは、APIテストを自動で実行するためのコマンドやスクリプトを生成します。開発環境や、JenkinsのようなCI/CD(継続的インテグレーション/継続的デリバリー)システムでPostmanのテストコレクションを実行するのに役立ちます。

使う場面

  • ✓グラフィカルな画面を開かずに、PostmanのAPIテストを実行したいとき。
  • ✓CI/CDパイプラインでAPIテストの実行を自動化したいとき。
  • ✓HTMLやXMLなどの形式でAPIテストのレポートを生成したいとき。

スキルのリンク

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/postman-newman-automation/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/postman-newman-automation/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“「prod.json」環境を使って「api_tests.json」コレクションを実行し、「report.html」という名前のHTMLレポートを生成するコマンドを作成してください。テストが失敗したら停止するようにしてください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

このツールは、Postmanのコマンドラインプログラムである Newman を使います。コレクションファイル、環境、レポート形式を指定するオプションを含め、必要なコマンドを組み立てます。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Postman Newman Automation

When to Use

Use this skill when you need generate Newman CLI commands, configuration files, Jenkins pipeline scripts, and shell automation for running Postman collections in CI/CD or local environments. Use this skill whenever the user wants to run Postman collections from the command line, automate API tests, integrate...

Generates Newman CLI commands, shell scripts, and Jenkins pipeline configs for running Postman collections in automated environments.


Newman Basics

Newman is Postman's CLI runner. Install with:

npm install -g newman
# Optional HTML reporter:
npm install -g newman-reporter-htmlextra

Core Command Structure

newman run <collection> \
  --environment <env-file> \
  --globals <globals-file> \
  --iteration-count <n> \
  --iteration-data <csv-or-json> \
  --reporters <reporter-list> \
  --reporter-htmlextra-export <output.html> \
  --reporter-junit-export <results.xml> \
  --timeout-request <ms> \
  --delay-request <ms> \
  --bail \
  --color on

Step 1 — Gather Requirements

Ask or infer from context:

Parameter Question
Collection source File path, URL, or Postman API UID?
Environment File path or inline variables?
Reporter(s) CLI only, HTML report, JUnit XML?
Fail behavior Stop on first failure (--bail) or run all?
Iterations Single run or data-driven (CSV/JSON)?
Target Local shell, Jenkins, or both?

Step 2 — Generate Newman Command

Basic run (local)

newman run collection.json \
  --environment environment.json \
  --reporters cli,htmlextra \
  --reporter-htmlextra-export reports/report.html \
  --bail

Run from Postman API (by UID)

newman run "https://api.getpostman.com/collections/<UID>?apikey={{POSTMAN_API_KEY}}" \
  --environment environment.json \
  --reporters cli,junit \
  --reporter-junit-export results/junit.xml

Data-driven run (CSV)

newman run collection.json \
  --iteration-data test-data.csv \
  --iteration-count 5 \
  --reporters cli,htmlextra \
  --reporter-htmlextra-export reports/data-driven-report.html

With environment variable overrides (no file needed)

newman run collection.json \
  --env-var "base_url=https://staging.api.example.com" \
  --env-var "token=abc123" \
  --reporters cli

Step 3 — Shell Script

Generate a reusable shell script:

#!/bin/bash
set -e

# Configuration
COLLECTION="./collection.json"
ENVIRONMENT="./environment.json"
REPORT_DIR="./reports"
TIMESTAMP=$(date +"%Y%m%d_%H%M%S")

# Ensure report directory exists
mkdir -p "$REPORT_DIR"

echo "Running Newman collection: $COLLECTION"

newman run "$COLLECTION" \
  --environment "$ENVIRONMENT" \
  --reporters cli,htmlextra,junit \
  --reporter-htmlextra-export "$REPORT_DIR/report_$TIMESTAMP.html" \
  --reporter-junit-export "$REPORT_DIR/junit_$TIMESTAMP.xml" \
  --timeout-request 10000 \
  --bail

EXIT_CODE=$?

if [ $EXIT_CODE -eq 0 ]; then
  echo "✅ All tests passed."
else
  echo "❌ Tests failed. Check report: $REPORT_DIR/report_$TIMESTAMP.html"
  exit $EXIT_CODE
fi

Step 4 — Jenkins Pipeline

Declarative Jenkinsfile (preferred)

pipeline {
  agent any

  environment {
    POSTMAN_ENV = credentials('postman-environment-file') // Jenkins credential ID
  }

  stages {
    stage('Install Newman') {
      steps {
        sh 'npm install -g newman newman-reporter-htmlextra'
      }
    }

    stage('Run API Tests') {
      steps {
        sh """
          newman run collection.json \\
            --environment ${POSTMAN_ENV} \\
            --reporters cli,htmlextra,junit \\
            --reporter-htmlextra-export reports/report.html \\
            --reporter-junit-export reports/junit.xml \\
            --timeout-request 10000 \\
            --bail
        """
      }
    }
  }

  post {
    always {
      // Archive HTML report
      publishHTML(target: [
        allowMissing: false,
        alwaysLinkToLastBuild: true,
        keepAll: true,
        reportDir: 'reports',
        reportFiles: 'report.html',
        reportName: 'Newman API Test Report'
      ])
      // Archive JUnit results
      junit 'reports/junit.xml'
    }
    failure {
      echo 'API tests failed! Check the Newman report.'
    }
  }
}

Scripted Jenkinsfile (if declarative not available)

node {
  stage('Install Newman') {

…
よくある質問

Newmanとは何ですか?

Postmanのコマンドライン版です。Postmanの画面を開かずに、ターミナルから直接APIテストを実行できます。

Postmanの「コレクション」と「環境」とは何ですか?

コレクションは、APIのリクエストとテストをまとめたものです。環境は、テストする場所(開発環境、本番環境など)によって変わる変数(URLやトークンなど)を保存します。

CI/CDとは何ですか?

CI/CD(継続的インテグレーション/継続的デリバリー)は、テストやデプロイを自動化するソフトウェア開発の手法です。このために、Jenkinsなどのツールが使われます。

詳細

作者による元の説明

Generate Newman CLI commands, configuration files, Jenkins pipeline scripts, and shell automation for running Postman collections in CI/CD or local environments.

repo: sickn33/agentic-awesome-skills

人気

GitHubのスター
48k
ランキング
#5477
ライセンス
MIT
更新日
2026/10/15

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル