Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问许可证需确认审计异常

testing-strategy测试策略

Agent Skill

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

总安装

267

周安装

11

GitHub Stars

8

下载量

87
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/ar4mirez/samuel --skill testing-strategy

简介

testing-strategy 用于辅助测试设计、自动化测试和回归验证,适合编写单元测试和端到端测试用例。

  • 适用于测试覆盖率提升、测试计划制定和失败日志分析,支持 CI/CD 集成和测试框架配置。
  • 通过 npx skills add 命令从指定 GitHub 仓库安装,需确认项目测试框架和运行命令。
  • 避免为了通过测试而改坏真实逻辑,涉及浏览器或外部服务时应区分模拟环境和生产环境。
  • 当前无详细 SKILL.md 内容,需参考仓库中的 Testing Strategy 了解覆盖率目标和测试前提条件。

SKILL.md

Testing Strategy

Systematic test planning and coverage improvement workflow.

When to Use

TriggerDescription
Post-COMPLEX FeatureAfter implementing major features
Coverage DropWhen coverage falls below thresholds
Test Debt SprintDedicated testing improvement effort
New ProjectEstablishing testing foundation
Pre-ReleaseEnsuring quality before deployment

Coverage Targets

CategoryTargetWarningCritical
Business Logic>80%70-80%<70%
Overall>60%50-60%<50%
Critical Paths>90%80-90%<80%

Prerequisites

Before starting:

  • Test framework configured
  • Coverage tool available
  • CI/CD running tests
  • Access to current coverage report
  • Understanding of business-critical features

Strategy Process

Phase 1: Coverage Analysis
    ↓
Phase 2: Critical Path Identification
    ↓
Phase 3: Test Pyramid Planning
    ↓
Phase 4: Test Prioritization
    ↓
Phase 5: Edge Case Planning
    ↓
Phase 6: Flaky Test Remediation
    ↓
Phase 7: Implementation Roadmap

Phase 1: Coverage Analysis

1.1 Generate Coverage Report

Node.js (Jest/Vitest):

npm test -- --coverage
# or
npx vitest run --coverage

Python (pytest):

pytest --cov=src --cov-report=html

Go:

go test -cover ./...
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out

Rust:

cargo tarpaulin --out Html

1.2 Analyze Coverage Gaps

Review coverage report for:

AreaTargetCurrentGap
src/auth/90%45%-45%
src/api/80%62%-18%
src/utils/60%78%+18%
Overall60%55%-5%

1.3 Identify Uncovered Files

List files with lowest coverage:

Lowest Coverage Files:
1. src/auth/oauth.ts - 12% (critical!)
2. src/api/payments.ts - 28% (critical!)
3. src/services/email.ts - 35%
4. src/utils/validation.ts - 42%
5. src/api/users.ts - 48%

Phase 2: Critical Path Identification

2.1 Define Critical Paths

Critical paths are user journeys that MUST work:

PathDescriptionFilesPriority
AuthenticationLogin, logout, sessionauth/*P0
CheckoutCart → Payment → Confirmpayments/*, cart/*P0
RegistrationSignup → Verify → Profileusers/*, email/*P1
SearchQuery → Results → Filtersearch/*, api/*P1

2.2 Map Critical Files

For each critical path, list involved files:

Authentication Path:

src/auth/login.ts        - 45% coverage
src/auth/session.ts      - 52% coverage
src/auth/middleware.ts   - 88% coverage
src/models/user.ts       - 72% coverage

2.3 Calculate Critical Path Coverage

Authentication Path:
- Total lines: 450
- Covered lines: 267
- Coverage: 59% (target: 90%)
- Gap: 183 lines to cover

Phase 3: Test Pyramid Planning

3.1 Ideal Test Pyramid

         /\
        /  \
       / E2E \         10% - Slow, expensive, covers user flows
      /______\
     /        \
    /Integration\      20% - Medium speed, covers integrations
   /______________\
  /                \
 /    Unit Tests    \  70% - Fast, cheap, covers logic
/____________________\

3.2 Current Distribution

Analyze current test distribution:

Current State:
- Unit tests: 45 (60%)
- Integration: 25 (33%)
- E2E: 5 (7%)

Ideal State:
- Unit tests: 70 (70%)
- Integration: 20 (20%)
- E2E: 10 (10%)

Gap:
- Need +25 unit tests
- Need -5 integration tests (or OK)
- Need +5 E2E tests

3.3 Test Type Guidelines

Unit Tests (70%):

  • Pure functions
  • Business logic
  • Utility functions
  • Model methods
  • State transitions

Integration Tests (20%):

  • API endpoints
  • Database operations
  • Service interactions
  • Authentication flows
  • External service mocks

E2E Tests (10%):

  • Critical user journeys
  • Happy path scenarios
  • Cross-system flows
  • Smoke tests

Phase 4: Test Prioritization

4.1 Priority Matrix

PriorityCriteriaExample
P0Critical path, no testsPayment processing
P1Critical path, low coverageAuthentication
P2High risk, medium coverageData validation
P3Medium risk, any coverageUtility functions
P4Low risk, nice to haveFormatting helpers

4.2 Effort Estimation

Test TypeEffortCoverage Impact
Unit (simple)15 minHigh
Unit (complex)1 hourHigh
Integration2 hoursMedium
E2E4 hoursLow (but valuable)

4.3 Prioritized Test Backlog

## Test Backlog

### P0 - Immediate (This Sprint)
- [ ] Unit: payment.processPayment()
- [ ] Unit: auth.validateToken()
- [ ] Integration: POST /api/payments
- [ ] E2E: Complete checkout flow

### P1 - High (Next Sprint)
- [ ] Unit: auth.refreshToken()
- [ ] Unit: user.validateEmail()
- [ ] Integration: GET /api/users/:id
- [ ] E2E: Registration flow

### P2 - Medium (Backlog)
- [ ] Unit: validation helpers
- [ ] Unit: formatting utilities
- [ ] Integration: Search API

### P3 - Low (Nice to Have)
- [ ] Unit: logging utilities
- [ ] Unit: config loaders

Phase 5: Edge Case Planning

5.1 Required Edge Cases

Every function should test:

CategoryCasesExample
Null/Undefinednull, undefined inputvalidateUser(null)
Empty"", [], {}searchUsers("")
Boundary0, -1, MAX_INTsetQuantity(0)
Invalid TypeWrong type inputcalculatePrice("abc")
ConcurrentRace conditionsParallel updates

5.2 Edge Case Checklist

For each function:

  • Happy path tested
  • Null input tested
  • Undefined input tested
  • Empty input tested
  • Minimum boundary tested
  • Maximum boundary tested
  • Invalid type tested
  • Error conditions tested

Phase 6: Flaky Test Remediation

6.1 Identify Flaky Tests

Signs of flaky tests:

  • Intermittent failures in CI
  • Tests that pass locally but fail in CI
  • Tests that depend on execution order
  • Tests with timing-dependent assertions

6.2 Common Causes & Fixes

CauseSymptomFix
TimingRandom timeoutsUse proper async/await
Order dependencyFails when run aloneReset state in beforeEach
Shared stateRandom failuresIsolate test data
External servicesNetwork failuresMock external calls
Date/timeFails at midnightMock dates

Phase 7: Implementation Roadmap

7.1 Sprint Planning Template

## Sprint 1: Critical Path (2 weeks)

### Goals
- Achieve 90% coverage on authentication
- Achieve 90% coverage on payments
- Add 5 E2E tests for critical paths

### Tasks
1. Unit tests for auth module (20 tests)
2. Unit tests for payment module (15 tests)
3. Integration tests for auth API (5 tests)
4. E2E test: Complete checkout (1 test)
5. E2E test: Login flow (1 test)

### Expected Outcome
- Overall coverage: 55% → 65%
- Critical path coverage: 59% → 90%

7.2 Test Writing Guidelines

Test Structure:

describe('Module or Function', () => {
  // Setup
  beforeEach(() => {
    // Reset state
  });

  describe('method or scenario', () => {
    it('should [expected behavior] when [condition]', () => {
      // Arrange
      const input = createTestInput();

      // Act
      const result = functionUnderTest(input);

      // Assert
      expect(result).toEqual(expectedOutput);
    });
  });
});

Naming Convention:

should [expected behavior] when [condition]

Examples:
- should return user when valid ID provided
- should throw error when user not found
- should update timestamp when saving

7.3 Coverage Tracking

Track coverage weekly:

WeekOverallBusinessCriticalTests Added
155%62%59%+15
262%75%78%+22
368%82%88%+18
472%85%92%+12

Quick Reference

Coverage Commands

# Node.js
npm test -- --coverage --coverageReporters=text-summary

# Python
pytest --cov=src --cov-report=term-missing

# Go
go test -cover ./... | grep -E "coverage:"

# Rust
cargo tarpaulin --out Stdout

Test Templates

Unit Test:

describe('functionName', () => {
  it('should [behavior] when [condition]', () => {
    const result = functionName(input);
    expect(result).toEqual(expected);
  });
});

Integration Test:

describe('POST /api/resource', () => {
  it('should create resource when valid data', async () => {
    const response = await request(app)
      .post('/api/resource')
      .send(validData);
    expect(response.status).toBe(201);
  });
});

Checklist

Analysis

  • Coverage report generated
  • Gaps identified
  • Critical paths mapped
  • Current pyramid analyzed

Planning

  • Tests prioritized
  • Edge cases documented
  • Flaky tests identified
  • Sprint plan created

Implementation

  • P0 tests written
  • P1 tests written
  • Edge cases covered
  • Flaky tests fixed

Validation

  • Coverage targets met
  • All tests passing
  • No flaky tests
  • CI/CD updated

Extended Resources

For detailed examples, patterns, and in-depth guidance, see:

  • references/process.md - Comprehensive testing patterns and examples

Related Resources

  • code-review - Includes test validation
  • refactoring - Tests enable safe refactoring
  • troubleshooting - When tests fail unexpectedly

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

35.49%
按下载量换算31

Claude

30.41%
按下载量换算26

Cursor

20.1%
按下载量换算17

Gemini CLI

9.66%
按下载量换算8

安全审计

Gen Agent Trust Hub

未通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills