Token导航 LogoToken导航

Agent Skill · 研究检索

testing-strategies(测试策略)

用于辅助界面设计、视觉规范、排版、配色、布局和交互体验优化。它适合让 Agent 根据产品场景整理页面结构、生成 UI 方案、检查视觉一致性或改进组件层级。使用时需要结合现有品牌、设计系统和用户任务,不应只堆装饰元素;涉及真实页面改动时,应通过截图或浏览器预览检查文本溢出、对齐和响应式表现。

testing-strategies 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为接触敏感数据;许可证为 MIT,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 49,433。

总安装 652周安装 28GitHub Stars 350下载 228核验 2026-05-01

安装说明

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

安装方式

通过对话安装

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

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

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/ancoleman/ai-design-components --skill testing-strategies

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

用于构建全面有效的测试策略,涵盖单元、集成、端到端和契约测试。适合在 TypeScript、Python、Go、Rust 等多语言环境中实施一致测试模式。通过命令行调用测试选择、测试金字塔平衡和多语言实现框架。需结合项目技术栈确认测试层级分布与数据管理策略。

testing-strategies 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

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

上手步骤

4 步
  1. 1

    确认自己的宿主工具

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

  2. 2

    拿到安装命令

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

  3. 3

    安装后重启宿主

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

  4. 4

    按最小权限试用

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

常见问题

6 条

testing-strategies 怎么安装?

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

testing-strategies 支持哪些 AI 工具?

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

testing-strategies 需要什么权限?

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

testing-strategies 是免费的吗?

来源标注的许可证是 MIT。本站不代收任何费用,也不托管安装包;能否商用、要不要署名,以许可证原文为准。

testing-strategies 用的人多吗?

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

testing-strategies 安全吗?

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

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

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 3 个目录同时收录,说明这个 Skill 流传比较广。
  • 许可证明确为 MIT,商用和分发边界好判断。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 需要接触敏感数据,装到常用环境前要先评估影响面。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。
  • 需要许可证清楚、并且有第三方扫描结果的团队项目。

不太适合

  • 环境里有大量密钥、凭证,不方便给第三方 Skill 读取的人。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

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

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
testing-strategies

测试策略 · 本页

652350接触敏感数据MIT通过

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

SKILL.md 原文

Testing Strategies

Build comprehensive, effective test suites by strategically selecting and implementing the right testing approaches across unit, integration, E2E, and contract testing levels.

Purpose

This skill provides strategic frameworks for:

  • Test Type Selection: Determine when to use unit vs. integration vs. E2E vs. contract testing
  • Test Pyramid Balancing: Optimize test distribution for fast feedback and reliable coverage
  • Multi-Language Implementation: Apply consistent testing patterns across TypeScript, Python, Go, and Rust
  • Test Data Management: Choose appropriate strategies (fixtures, factories, property-based testing)
  • CI/CD Integration: Integrate tests into automated pipelines with optimal execution patterns

Testing is foundational to reliable software. With microservices architectures and continuous delivery becoming standard in 2025, strategic testing across multiple levels is more critical than ever.

When to Use This Skill

Invoke this skill when:

  • Building a new feature that requires test coverage
  • Designing a testing strategy for a new project
  • Refactoring existing tests to improve speed or reliability
  • Setting up CI/CD pipelines with testing stages
  • Choosing between unit, integration, or E2E testing approaches
  • Implementing contract testing for microservices
  • Managing test data with fixtures, factories, or property-based testing

The Testing Pyramid Framework

Core Concept

The testing pyramid guides test distribution for optimal speed and confidence:

         /\
        /  \  E2E Tests (10%)
       /----\  - Slow but comprehensive
      /      \  - Full stack validation
     /--------\
    /          \  Integration Tests (20-30%)
   /            \  - Moderate speed
  /--------------\  - Component interactions
 /                \
/------------------\  Unit Tests (60-70%)
                      - Fast feedback
                      - Isolated units

Key Principle: More unit tests (fast, isolated), fewer E2E tests (slow, comprehensive). Integration tests bridge the gap.

Modern Adaptations (2025)

Microservices Adjustment:

  • Add contract testing layer between unit and integration
  • Increase integration/contract tests to 30% (validate service boundaries)
  • Reduce E2E tests to critical user journeys only

Cloud-Native Patterns:

  • Use containers for integration tests (ephemeral databases, test services)
  • Parallel execution for fast CI/CD feedback
  • Risk-based test prioritization (focus on high-impact areas)

For detailed pyramid guidance, see references/testing-pyramid.md.

Universal Testing Decision Tree

Which Test Type Should I Use?

START: Need to test [feature]

Q1: Does this involve multiple systems/services?
  ├─ YES → Q2
  └─ NO  → Q3

Q2: Is this a critical user-facing workflow?
  ├─ YES → E2E Test (complete user journey)
  └─ NO  → Integration or Contract Test

Q3: Does this interact with external dependencies (DB, API, filesystem)?
  ├─ YES → Integration Test (real DB, mocked API)
  └─ NO  → Q4

Q4: Is this pure business logic or a pure function?
  ├─ YES → Unit Test (fast, isolated)
  └─ NO  → Component or Integration Test

Test Type Selection Examples

FeatureTest TypeRationale
calculateTotal(items)UnitPure function, no dependencies
POST /api/users endpointIntegrationTests API + database interaction
User registration flow (form → API → redirect)E2ECritical user journey, full stack
Microservice A → B communicationContractService interface validation
formatCurrency(amount, locale)Unit + PropertyPure logic, many edge cases
Form validation logicUnitIsolated business rules
File upload to S3IntegrationExternal service interaction

For comprehensive decision frameworks, see references/decision-tree.md.

Testing Levels in Detail

Unit Testing (Foundation - 60-70%)

Purpose: Validate small, isolated units of code (functions, methods, components)

Characteristics:

  • Fast (milliseconds per test)
  • Isolated (no external dependencies)
  • Deterministic (same input = same output)
  • Broad coverage (many tests, small scope each)

When to Use:

  • Pure functions (input → output)
  • Business logic and algorithms
  • Utility functions
  • Component rendering (without integration)
  • Validation logic

Recommended Tools:

  • TypeScript/JavaScript: Vitest (primary, 10x faster than Jest), Jest (legacy)
  • Python: pytest (industry standard)
  • Go: testing package (stdlib) + testify (assertions)
  • Rust: cargo test (stdlib)

For detailed patterns, see references/unit-testing-patterns.md.

Integration Testing (Middle Layer - 20-30%)

Purpose: Validate interactions between components, modules, or services

Characteristics:

  • Moderate speed (seconds per test)
  • Partial integration (real database, mocked external APIs)
  • Focused scope (test component boundaries)
  • API and database validation

When to Use:

  • API endpoints (request → response)
  • Database operations (CRUD, queries)
  • Service-to-service communication
  • Event handlers and message processing
  • File I/O operations

Recommended Tools:

  • TypeScript/JavaScript: Vitest + MSW (API mocking), Supertest (HTTP testing)
  • Python: pytest + pytest-httpserver, pytest-postgresql
  • Go: testing + httptest, testcontainers
  • Rust: cargo test + mockito, testcontainers

For detailed patterns, see references/integration-testing-patterns.md.

End-to-End Testing (Top Layer - 10%)

Purpose: Validate complete user workflows across the entire application stack

Characteristics:

  • Slow (minutes per test suite)
  • Full integration (real browser, services, database)
  • Wide scope (user journeys from start to finish)
  • Prone to flakiness (requires careful design)

When to Use:

  • Critical user journeys (login, checkout, payment)
  • Cross-browser compatibility validation
  • Real-world scenarios not covered by integration tests
  • Regression prevention for core features

Best Practices:

  • Limit E2E tests to high-value scenarios (not every edge case)
  • Use stable selectors (data-testid, not CSS classes)
  • Implement retry logic for network flakiness
  • Run tests in parallel for speed

Recommended Tools:

  • All Languages: Playwright (cross-browser, fast, Microsoft-backed)

For detailed patterns, see references/e2e-testing-patterns.md.

Contract Testing (Microservices)

Purpose: Validate service interfaces and API contracts without full integration

When to Use:

  • Microservices architecture
  • Service-to-service communication
  • API contract validation
  • Reducing E2E testing overhead

Recommended Tool: Pact (pact.io) - supports TypeScript, Python, Go, Rust

For detailed patterns, see references/contract-testing.md.

Test Data Management Strategies

When to Use Each Approach

Fixtures (Static Data):

  • Pros: Deterministic, easy to debug
  • Cons: Can become stale, doesn't test variety
  • Use When: Testing known scenarios, regression tests

Factories (Generated Data):

  • Pros: Flexible, generates variety
  • Cons: Less deterministic, harder to debug
  • Use When: Need diverse test data, testing edge cases

Property-Based Testing (Random Data):

  • Pros: Finds edge cases not anticipated
  • Cons: Can be slow, failures harder to reproduce
  • Use When: Complex algorithms, parsers, validators

Recommended Combination:

  • Unit Tests: Fixtures (known inputs) + Property-Based (edge cases)
  • Integration Tests: Factories (flexible data) + Database seeding
  • E2E Tests: Fixtures (reproducible scenarios)

Property-Based Testing Tools:

  • TypeScript/JavaScript: fast-check
  • Python: hypothesis (best-in-class)
  • Go: gopter
  • Rust: proptest (primary)

For detailed strategies, see references/test-data-strategies.md.

Mocking Decision Matrix

When to Mock vs. Use Real Dependencies

DependencyUnit TestIntegration TestE2E Test
DatabaseMock (in-memory)Real (test DB, Docker)Real (staging DB)
External APIMock (MSW, nock)Mock (MSW, VCR)Real (or staging)
FilesystemMock (in-memory FS)Real (temp directory)Real
Time/DateMock (freezeTime)Mock (if deterministic)Real (usually)
Environment VariablesMock (setEnv)Mock (test config)Real (test env)
Internal ServicesMock (stub)Real (or container)Real

Guiding Principles:

  1. Unit Tests: Mock everything external
  2. Integration Tests: Use real database (ephemeral), mock external APIs
  3. E2E Tests: Use real everything (or staging equivalents)
  4. Contract Tests: Mock nothing (test real interfaces)

For detailed mocking patterns, see references/mocking-strategies.md.

Language-Specific Quick Starts

TypeScript/JavaScript

Unit Testing with Vitest:

import { describe, test, expect } from 'vitest'

test('calculates total with tax', () => {
  const items = [{ price: 10, quantity: 2 }]
  expect(calculateTotal(items, 0.1)).toBe(22)
})

Integration Testing with MSW:

import { setupServer } from 'msw/node'
import { http, HttpResponse } from 'msw'

const server = setupServer(
  http.get('/api/user/:id', ({ params }) => {
    return HttpResponse.json({ id: params.id, name: 'Test User' })
  })
)

E2E Testing with Playwright:

import { test, expect } from '@playwright/test'

test('user can checkout', async ({ page }) => {
  await page.goto('https://example.com')
  await page.getByRole('button', { name: 'Add to Cart' }).click()
  await expect(page.getByText('1 item in cart')).toBeVisible()
})

See examples/typescript/ for complete working examples.

Python

Unit Testing with pytest:

def test_calculate_total_with_tax():
    items = [{"price": 10, "quantity": 2}]
    assert calculate_total(items, tax_rate=0.1) == 22

Property-Based Testing with hypothesis:

from hypothesis import given, strategies as st

@given(st.lists(st.integers()))
def test_reverse_reverse_is_identity(lst):
    assert reverse(reverse(lst)) == lst

See examples/python/ for complete working examples.

Go and Rust

See examples/go/ and examples/rust/ for complete working examples in these languages.

Coverage and Quality Metrics

Meaningful Coverage Targets

Recommended Targets:

  • Critical Business Logic: 90%+ coverage
  • API Endpoints: 80%+ coverage
  • Utility Functions: 70%+ coverage
  • UI Components: 60%+ coverage (focus on logic, not markup)
  • Overall Project: 70-80% coverage

Anti-Pattern: Aiming for 100% coverage leads to testing trivial code and false confidence.

Coverage Tools:

  • TypeScript/JavaScript: Vitest coverage (c8/istanbul)
  • Python: pytest-cov
  • Go: go test -cover
  • Rust: cargo-tarpaulin

Mutation Testing (Validate Test Quality)

Mutation testing introduces bugs and verifies tests catch them.

Tools:

  • TypeScript/JavaScript: Stryker Mutator
  • Python: mutmut
  • Go: go-mutesting
  • Rust: cargo-mutants

For detailed coverage strategies, see references/coverage-strategies.md.

CI/CD Integration Patterns

Fast Feedback Loop Strategy

Stage 1: Pre-Commit (< 30 seconds)

  • Lint and format checks
  • Unit tests (critical paths only)

Stage 2: On Commit (< 2 minutes)

  • All unit tests
  • Static analysis

Stage 3: Pull Request (< 5 minutes)

  • Integration tests
  • Coverage reporting

Stage 4: Pre-Merge (< 10 minutes)

  • E2E tests (critical paths)
  • Cross-browser testing

Parallel Execution

Speed Up Test Runs:

  • Vitest: vitest --threads
  • Playwright: playwright test --workers=4
  • pytest: pytest -n auto (requires pytest-xdist)
  • Go: go test -parallel 4

Common Anti-Patterns to Avoid

The Ice Cream Cone (Inverted Pyramid)

Problem: Too many E2E tests, too few unit tests Result: Slow test suites, flaky tests, long feedback loops Solution: Rebalance toward more unit tests, fewer E2E tests

Testing Implementation Details

Problem: Tests coupled to internal structure, not behavior Solution: Test behavior (inputs → outputs), not implementation

Over-Mocking in Integration Tests

Problem: Mocking everything defeats purpose of integration tests Solution: Use real databases (ephemeral), mock only external APIs

Flaky E2E Tests

Problem: Tests fail intermittently due to timing issues Solutions:

  • Use auto-wait features (Playwright has built-in auto-wait)
  • Avoid hardcoded waits (sleep(1000))
  • Use stable selectors (data-testid)
  • Implement retry logic for network requests

Integration with Other Skills

For form testing: See building-forms skill for form-specific validation and submission testing patterns.

For API testing: See api-patterns skill for REST/GraphQL endpoint testing and contract validation.

For CI/CD pipelines: See building-ci-pipelines skill for test automation, parallel execution, and coverage reporting.

For data visualization testing: See visualizing-data skill for snapshot testing chart configurations and visual regression testing.

Reference Documentation

For deeper exploration of specific topics:

  • references/testing-pyramid.md - Detailed testing pyramid framework and balancing strategies
  • references/decision-tree.md - Comprehensive decision frameworks for test type selection
  • references/unit-testing-patterns.md - Unit testing patterns across languages
  • references/integration-testing-patterns.md - Integration testing with databases, APIs, and containers
  • references/e2e-testing-patterns.md - E2E testing best practices and Playwright patterns
  • references/contract-testing.md - Consumer-driven contract testing with Pact
  • references/test-data-strategies.md - Fixtures, factories, and property-based testing
  • references/mocking-strategies.md - When and how to mock dependencies
  • references/coverage-strategies.md - Meaningful coverage metrics and mutation testing

Working Examples

Complete, runnable code examples are available in the examples/ directory:

  • examples/typescript/ - Vitest unit/integration, Playwright E2E, MSW mocking, fast-check property tests
  • examples/python/ - pytest unit/integration, fixtures, Playwright E2E, hypothesis property tests
  • examples/go/ - stdlib testing, testify assertions, httptest integration
  • examples/rust/ - cargo test unit tests, proptest property tests, integration patterns

All examples include dependencies, usage instructions, and error handling.

平台分布

Claude Code

32.26%
按下载量换算74

OpenCode

23.69%
按下载量换算54

Gemini CLI

17.48%
按下载量换算40

Antigravity

12.67%
按下载量换算29

Cursor

8.32%
按下载量换算19

mux

3.52%
按下载量换算8

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

接触敏感数据

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

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

继续浏览同类 Skills