Closed2

k6

KanonKanon

Macへのインストール

brew install k6

並列でリクエストを投げるシナリオ

import http from 'k6/http';
import { check } from 'k6';

export default function () {
    // カスタムヘッダーを含む複数のリクエストを並列で送信
    const responses = http.batch([
        {
            method: 'GET',
            url: 'https://example.com/page1',
            params: {
                        headers: {
                            'Authorization': 'Bearer myAccessToken1',
                            'Custom-Header': 'value1'
                        }
            }
        },
        {
            method: 'GET',
            url: 'https://example.com/page2',
            params: {
                        headers: {
                            'Authorization': 'Bearer myAccessToken1',
                            'Custom-Header': 'value1'
                        }
            }
        },
        // 他のリクエストも同様に追加
    ]);
  // レスポンスのチェック
  responses.forEach((res) => {
    check(res, {
      "status is 200": (r) => r.status === 200,
    });
  });
}
このスクラップは13日前にクローズされました