Token导航 LogoToken导航

Agent Skill · 开发

setup-sdk-testing(设置 SDK 测试)

用于辅助测试设计、自动化测试、用例整理和回归验证。它适合让 Agent 编写单元测试、端到端测试、测试计划或根据失败日志定位问题。使用时需要确认项目测试框架、运行命令和夹具数据,避免为了通过测试而改坏真实逻辑;涉及浏览器或外部服务时,应区分本地模拟、测试环境和生产环境。

setup-sdk-testing 是开发类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为接触敏感数据;许可证信息还不明确,第三方扫描已通过,按安装量在开发类的 21,746 个 Skill 里排第 13,111。

总安装 1,008周安装 42GitHub Stars 13下载 336核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:setup-sdk-testing(设置 SDK 测试)
来源仓库:https://github.com/speakeasy-api/skills
仓库路径:skills/setup-sdk-testing
安装命令:
npx skills add https://github.com/speakeasy-api/skills --skill setup-sdk-testing
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/speakeasy-api/skills --skill setup-sdk-testing

这个 Skill 是做什么的

开发类 Skill 面向写代码、改代码和排查问题,一般会读写仓库文件,部分还会执行构建或测试命令。

提供 SDK 测试框架配置与自动化用例生成支持。适用于 Codex、Claude、Cursor、Gemini CLI 中需要验证接口稳定性的场景。通过 npx skills add 命令从 speakeasy-api/skills 仓库安装。可能生成 mock 数据或启动测试服务器,应区分单元与集成测试层级。

注意测试覆盖率与真实业务场景的匹配度,避免虚假通过。

来源仓库内路径:skills/setup-sdk-testing

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/speakeasy-api/skills --skill setup-sdk-testing;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要接触敏感数据,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

setup-sdk-testing 怎么安装?

在终端执行 npx skills add https://github.com/speakeasy-api/skills --skill setup-sdk-testing。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

setup-sdk-testing 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

setup-sdk-testing 需要什么权限?

权限级别是接触敏感数据。该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

setup-sdk-testing 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

setup-sdk-testing 用的人多吗?

公开数据是累计安装 1,008 次,近一周安装 42 次,下载 336 次,GitHub 13 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

setup-sdk-testing 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 需要接触敏感数据,装到常用环境前要先评估影响面。
  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理开发类任务、又不想每次都手写提示词的人。

不太适合

  • 环境里有大量密钥、凭证,不方便给第三方 Skill 读取的人。
  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

开发类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
skill-vetter

技能审查员 · OpenClaw

8,779,018986操作浏览器MIT-0通过
ontology

本体论 · OpenClaw

6,636,960576只读MIT-0通过
entra-app-registration

内部应用程序注册 · Codex、Claude

6,631,872764接触敏感数据未明确通过
entra-app-registration

内部应用程序注册 · Codex、Claude

3,757,680201接触敏感数据未明确通过
nano-banana-pro

纳米香蕉专业版 · OpenClaw

3,526,898364接触敏感数据MIT-0有提醒
setup-sdk-testing

设置 SDK 测试 · 本页

1,00813接触敏感数据未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

setup-sdk-testing

Set up and run tests for Speakeasy-generated SDKs using contract testing, custom Arazzo workflows, or integration tests against live APIs.

Content Guides

TopicGuide
Arazzo Referencecontent/arazzo-reference.md

The Arazzo reference provides complete syntax for workflows, steps, success criteria, environment variables, and chaining operations.

When to Use

  • Setting up automated testing for a generated SDK
  • Enabling contract test generation via gen.yaml
  • Writing custom multi-step API workflow tests with Arazzo
  • Configuring integration tests against a live API
  • Debugging ResponseValidationError or test failures
  • User says: "test SDK", "contract testing", "Arazzo tests", "speakeasy test", "mock server", "test generation"

Inputs

InputRequiredDescription
gen.yamlYesGeneration config; contract testing is enabled here
OpenAPI specYesThe API spec the SDK is generated from
Target languageYestypescript, python, go, or java (contract test support)
.speakeasy/tests.arazzo.yamlNoCustom Arazzo test definitions
Live API credentialsNoRequired only for integration testing

Outputs

OutputLocation
Generated contract teststests/ directory in SDK output
Mock server configAuto-generated alongside contract tests
Arazzo test resultsTerminal output from speakeasy test
CI workflow.github/workflows/ (if integration testing configured)

Prerequisites

  • Speakeasy CLI installed and authenticated (speakeasy auth login)
  • A working SDK generation setup (gen.yaml + OpenAPI spec)
  • For integration tests: API credentials as environment variables

Decision Framework

Pick the right testing approach based on what you need:

NeedApproachEffort
Verify SDK types and methods match the API contractContract testingLow (auto-generated)
Test multi-step API workflows (create then verify)Custom Arazzo testsMedium
Validate against a live API with real dataIntegration testingHigh
Catch regressions on every SDK regenerationContract testing + CILow
Test authentication flows end-to-endIntegration testingHigh
Verify chained operations with data dependenciesCustom Arazzo testsMedium

Start with contract testing. It is auto-generated and catches the most common issues. Add custom Arazzo tests for workflow coverage, and integration tests only when live API validation is required.

Command

Enable Contract Testing

Add to gen.yaml:

generation:
  tests:
    generateTests: true

Then regenerate the SDK:

speakeasy run --output console

Run Tests

# Run all Arazzo-defined tests (contract + custom)
speakeasy test

# Run tests for a specific target
speakeasy test --target my-typescript-sdk

# Run with verbose output for debugging
speakeasy test --verbose

Run via CI

Contract tests run automatically in the Speakeasy GitHub Actions workflow when test generation is enabled. No additional CI configuration is needed for contract tests.

Example

1. Contract Testing (Quick Start)

Enable test generation in gen.yaml:

generation:
  tests:
    generateTests: true

Regenerate the SDK:

speakeasy run --output console

Run the generated tests:

speakeasy test

The CLI generates tests from your OpenAPI spec, creates a mock server that returns spec-compliant responses, and validates that the SDK correctly handles requests and responses.

2. Custom Arazzo Tests

Create or edit .speakeasy/tests.arazzo.yaml:

arazzo: 1.0.0
info:
  title: Custom SDK Tests
  version: 1.0.0

sourceDescriptions:
  - name: my-api
    type: openapi
    url: ./openapi.yaml

workflows:
  - workflowId: create-and-verify-resource
    steps:
      - stepId: create-resource
        operationId: createResource
        requestBody:
          payload:
            name: "test-resource"
            type: "example"
        successCriteria:
          - condition: $statusCode == 201
        outputs:
          resourceId: $response.body#/id

      - stepId: get-resource
        operationId: getResource
        parameters:
          - name: id
            in: path
            value: $steps.create-resource.outputs.resourceId
        successCriteria:
          - condition: $statusCode == 200
          - condition: $response.body#/name == "test-resource"

  - workflowId: list-and-filter
    steps:
      - stepId: list-resources
        operationId: listResources
        parameters:
          - name: limit
            in: query
            value: 10
        successCriteria:
          - condition: $statusCode == 200

Run the custom tests:

speakeasy test
Using Environment Variables in Arazzo Tests

Reference environment variables for sensitive values:

steps:
  - stepId: authenticated-request
    operationId: getProtectedResource
    parameters:
      - name: Authorization
        in: header
        value: Bearer $env.API_TOKEN
    successCriteria:
      - condition: $statusCode == 200
Disabling a Specific Test

Use an overlay to disable a generated test without deleting it:

overlay: 1.0.0
info:
  title: Disable flaky test
actions:
  - target: $["workflows"][?(@.workflowId=="flaky-test")]
    update:
      x-speakeasy-test:
        disabled: true

3. Integration Testing

For live API testing, use the SDK factory pattern:

TypeScript example:

import { SDK } from "./src";

function createTestClient(): SDK {
  return new SDK({
    apiKey: process.env.TEST_API_KEY,
    serverURL: process.env.TEST_API_URL ?? "https://api.example.com",
  });
}

describe("Integration Tests", () => {
  const client = createTestClient();

  it("should list resources", async () => {
    const result = await client.resources.list({ limit: 5 });
    expect(result.statusCode).toBe(200);
    expect(result.data).toBeDefined();
  });

  it("should create and delete resource", async () => {
    // Create
    const created = await client.resources.create({ name: "integration-test" });
    expect(created.statusCode).toBe(201);

    // Cleanup
    const deleted = await client.resources.delete({ id: created.data.id });
    expect(deleted.statusCode).toBe(204);
  });
});

Python example:

import os
import pytest
from my_sdk import SDK

@pytest.fixture
def client():
    return SDK(
        api_key=os.environ["TEST_API_KEY"],
        server_url=os.environ.get("TEST_API_URL", "https://api.example.com"),
    )

def test_list_resources(client):
    result = client.resources.list(limit=5)
    assert result.status_code == 200
    assert result.data is not None

@pytest.mark.cleanup
def test_create_and_delete(client):
    created = client.resources.create(name="integration-test")
    assert created.status_code == 201
    try:
        fetched = client.resources.get(id=created.data.id)
        assert fetched.data.name == "integration-test"
    finally:
        client.resources.delete(id=created.data.id)

GitHub Actions CI for integration tests:

name: Integration Tests
on:
  schedule:
    - cron: "0 6 * * 1-5"
  workflow_dispatch:

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: speakeasy-api/sdk-generation-action@v15
        with:
          speakeasy_version: latest
      - run: speakeasy test
        env:
          SPEAKEASY_API_KEY: ${{ secrets.SPEAKEASY_API_KEY }}
      - name: Run integration tests
        run: npm test -- --grep "integration"
        env:
          TEST_API_KEY: ${{ secrets.TEST_API_KEY }}
          TEST_API_URL: ${{ secrets.TEST_API_URL }}

What NOT to Do

  • Do NOT skip contract testing and jump straight to integration tests -- contract tests are free and catch most issues
  • Do NOT hardcode API keys or secrets in Arazzo test files -- use $env.VARIABLE_NAME syntax
  • Do NOT modify auto-generated test files directly -- they are overwritten on regeneration; use custom Arazzo tests instead
  • Do NOT disable failing contract tests without investigating -- a ResponseValidationError usually means the spec and API are out of sync
  • Do NOT run integration tests with destructive operations in production -- always use a test/staging environment
  • Do NOT assume all languages support contract testing -- currently supported: TypeScript, Python, Go, Java

Troubleshooting

ResponseValidationError in contract tests

The SDK response does not match the OpenAPI spec. Common causes:

  1. Spec is outdated: Regenerate from the latest API spec
  2. Missing required fields: Check your spec's required arrays match actual API responses
  3. Type mismatches: Verify type and format fields in schema definitions
# Regenerate with latest spec and re-run tests
speakeasy run --output console && speakeasy test --verbose

Tests pass locally but fail in CI

  1. Check that all environment variables are set in CI secrets
  2. Verify the CI runner has network access to mock server ports
  3. Ensure the Speakeasy CLI version matches between local and CI

speakeasy test command not found

Update the Speakeasy CLI:

speakeasy update

Mock server fails to start

  1. Check for port conflicts on the default mock server port
  2. Ensure the OpenAPI spec is valid: speakeasy lint openapi -s spec.yaml
  3. Verify generateTests: true is set in gen.yaml and the SDK has been regenerated

Custom Arazzo test not running

  1. Verify the file is at .speakeasy/tests.arazzo.yaml
  2. Check that operationId values match those in your OpenAPI spec exactly
  3. Validate YAML syntax -- indentation errors are the most common cause

Integration tests intermittently fail

  1. Add retry logic for network-dependent tests
  2. Use unique resource names with timestamps to avoid collisions
  3. Ensure cleanup runs even on test failure (use finally or afterEach)

平台分布

Codex

33.78%
按下载量换算114

Claude

33.22%
按下载量换算112

Cursor

18.37%
按下载量换算62

Gemini CLI

9.43%
按下载量换算32

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

接触敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills