Token导航 LogoToken导航TokenDH.com
研究检索操作浏览器github未标认证来源可访问clear审计未展示

run-tests运行测试

Agent Skill

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

总安装

367

周安装

15

GitHub Stars

公开资料未说明

下载量

119
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

2

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

AgentSkills.tonpx skills
npx skills add microck/ordinary-claude-skills --skill "run-tests"

简介

用于辅助测试设计、自动化测试、用例整理和回归验证。

  • 适合编写单元测试、端到端测试或根据失败日志定位问题。
  • 使用时需确认项目测试框架、运行命令和夹具数据。run-tests 属于研究检索类 Skill,可作为该场景下的辅助能力补充。
  • 涉及浏览器或外部服务时应区分本地模拟与生产环境。
  • 避免为了通过测试而改坏真实逻辑,需人工复核关键变更。

SKILL.md

name
run-tests
description
>
allowed-tools

Test Suite Validation Skill

This skill helps you efficiently validate code changes by running the appropriate subset of the test suite. It uses scripts/run-tests to intelligently discover affected tests and run only what's necessary for validation.

When to Use This Skill

Use this skill when you have:

  • Made changes to source code files and want to validate they work
  • Fixed a bug and want to verify the fix
  • Added a feature and need test coverage
  • Modified test infrastructure or configuration
  • Want to verify changes don't break existing functionality

Key Principles

  1. Always use the run-tests skill when testing code changes - it's optimized for intelligent suite discovery
  2. Never run pytest directly - bypasses the project's test infrastructure (use scripts/run-tests or riot via scripts/ddtest)
  3. Minimal venvs for iteration - run 1-2 venvs initially, expand only if needed
  4. Use --dry-run first - see what would run before executing
  5. Follow official docs - docs/contributing-testing.rst is the source of truth for testing procedures

How This Skill Works

Step 1: Identify Changed Files

First, determine which files were modified:

  • If you have pending edits, I'll identify the changed files from the current session
  • I'll look at git status to find staged, unstaged, and untracked changes
  • You can also specify files explicitly if working on specific changes

Step 2: Discover Available Test Suites

I'll use the scripts/run-tests script to discover what test suites match your changes:

scripts/run-tests --list <edited-files>

This outputs JSON showing:

  • Available test suites that match your changed files
  • All venvs (Python versions + package combinations) available for each suite
  • Their hashes, Python versions, and package versions

Step 3: Intelligently Select Venvs

Rather than running ALL available venvs (which could take hours), I'll select the minimal set needed to validate your changes:

For Core/Tracing Changes (Broad Impact)

When you modify files like:

  • ddtrace/internal/core/*, ddtrace/_trace/*, ddtrace/trace/*
  • ddtrace/_monkey.py, ddtrace/settings/*
  • ddtrace/constants.py

Strategy: Run core tracer + internal tests with 1 venv each

  • Example: tracer suite with latest Python + internal suite with latest Python
  • This validates broad-reaching changes without excessive overhead
  • Skip integration suites unless the change directly affects integration code

For Integration/Contrib Changes (Targeted Impact)

When you modify files like:

  • ddtrace/contrib/flask/*, ddtrace/contrib/django/*, etc.
  • ddtrace/contrib/*/patch.py or integration-specific code

Strategy: Run ONLY the affected integration suite with 1-2 venvs

  • Example: Flask changes → run contrib::flask suite with latest Python
  • If change involves multiple versions (e.g., Django 3.x and 4.x), pick 1 venv per major version
  • Skip unrelated integrations

For Test-Only Changes

When you modify tests/ files (but not test infrastructure):

  • Run only the specific test files/functions modified
  • Use pytest args: -- -k test_name or direct test file paths

For Test Infrastructure Changes

When you modify:

  • tests/conftest.py, tests/suitespec.yml, scripts/run-tests, riotfile.py

Strategy: Run a quick smoke test suite

  • Example: internal suite with 1 venv as a sanity check
  • Or run small existing test suites to verify harness changes

Step 4: Execute Selected Venvs

I'll run the selected venvs using:

scripts/run-tests --venv <hash1> --venv <hash2> ...

This will:

  • Start required Docker services (redis, postgres, etc.)
  • Run tests in the specified venvs sequentially
  • Stop services after completion
  • Show real-time output and status

Step 5: Handle Results

If tests pass: ✅ Your changes are validated!

If tests fail: 🔴 I'll:

  • Show you the failure details
  • Identify which venv failed
  • Ask clarifying questions to understand the issue
  • Offer to run specific failing tests with more verbosity
  • Help iterate on fixes and re-run

For re-running specific tests:

scripts/run-tests --venv <hash> -- -vv -k test_name

When Tests Fail

When you encounter test failures, follow this systematic approach:

  1. Review the failure details carefully - Don't just skim the error, understand what's actually failing
  2. Understand what's failing - Don't blindly re-run; analyze the root cause
  3. Make code changes - Fix the underlying issue
  4. Re-run with more verbosity if needed - Use -vv or -vvv for detailed output
  5. Iterate until tests pass - Repeat the process with each fix

Venv Selection Strategy in Detail

Understanding Venv Hashes

From scripts/run-tests --list, you'll see output like:

{
  "suites": [
    {
      "name": "tracer",
      "venvs": [
        {
          "hash": "abc123",
          "python_version": "3.8",
          "packages": "..."
        },
        {
          "hash": "def456",
          "python_version": "3.11",
          "packages": "..."
        }
      ]
    }
  ]
}

Selection Rules

  1. Latest Python version is your default choice

- Unless your change specifically targets an older Python version - Example: if fixing Python 3.8 compatibility, also test 3.8

  1. One venv per suite is usually enough for iteration

- Only run multiple venvs per suite if: - Change impacts multiple Python versions differently - Testing package compatibility variations (e.g., Django 3.x vs 4.x) - Initial validation passed and you want broader coverage

  1. Minimize total venvs

- 1-2 venvs total for small targeted changes - 3-4 venvs maximum for broader changes - Never run 10+ venvs for initial validation (save that for CI)

  1. Consider test runtime

- Each venv can take 5-30 minutes depending on suite - With 2 venvs you're looking at 10-60 minutes for iteration - With 5 venvs you're looking at 25-150 minutes - Scale appropriately for your patience and deadline

Using --venv Directly

When you have a specific venv hash you want to run, you can use it directly without specifying file paths:

scripts/run-tests --venv e06abee

The --venv flag automatically searches all available venvs across all suites, so it works regardless of what files you have locally changed. This is useful when:

  • You know exactly which venv you want to test
  • You have unrelated local changes that would otherwise limit suite matching
  • You want to quickly re-run a specific venv without file path arguments

Examples

Example 1: Fixing a Flask Integration Bug

Changed file: ddtrace/contrib/internal/flask/patch.py

scripts/run-tests --list ddtrace/contrib/internal/flask/patch.py
# Output shows: contrib::flask suite available

# Select output (latest Python):
# Suite: contrib::flask
# Venv: hash=e06abee, Python 3.13, flask

# Run with --venv directly (searches all venvs automatically)
scripts/run-tests --venv e06abee
# Runs just Flask integration tests

Example 2: Fixing a Core Tracing Issue

Changed file: ddtrace/_trace/tracer.py

scripts/run-tests --list ddtrace/_trace/tracer.py
# Output shows: tracer suite, internal suite available

# Select strategy:
# - tracer: latest Python (e.g., abc123)
# - internal: latest Python (e.g., def456)

# Run with --venv directly (searches all venvs automatically)
scripts/run-tests --venv abc123 --venv def456
# Validates core tracer and internal components

Example 3: Fixing a Test-Specific Bug

Changed file: tests/contrib/flask/test_views.py

scripts/run-tests --list tests/contrib/flask/test_views.py
# Output shows: contrib::flask suite

# Run just the specific test:
scripts/run-tests --venv flask_py311 -- -vv tests/contrib/flask/test_views.py

Example 4: Iterating on a Failing Test

First run shows one test failing:

scripts/run-tests --venv flask_py311 -- -vv -k test_view_called_twice
# Focused on the specific failing test with verbose output

Best Practices

DO ✅

  • Start small: Run 1 venv first, expand only if needed
  • Be specific: Use pytest -k filter when re-running failures
  • Check git: Verify you're testing the right files with git status
  • Read errors: Take time to understand test failures before re-running
  • Ask for help: When unclear what tests to run, ask me to analyze the changes

DON'T ❌

  • Run all venvs initially: That's what CI is for
  • Skip the minimal set guidance: It's designed to save you time
  • Ignore service requirements: Some suites need Docker services up
  • Run tests without changes saved: Make sure edits are saved first
  • Iterate blindly: Understand what's failing before re-running

Additional Testing Resources

For comprehensive testing guidance, refer to the contributing documentation:

- What kind of tests to write (unit tests, integration tests, e2e tests) - When to write tests (feature development, bug fixes) - Where to put tests in the repository - Prerequisites (Docker, uv) - Complete scripts/run-tests usage examples - Riot environment management details - Running specific test files and functions - Test debugging strategies

- All changes need tests or documented testing strategy - How tests fit into the PR review process - Testing expectations for different types of changes

- How products, integrations, and core interact - Where different types of tests should live - Testing patterns for each library component

When to reference these docs:

  • First time writing tests for this project → Read contributing-testing.rst
  • Understanding test requirements for PRs → Read contributing.rst
  • Need context on test architecture → Read contributing-design.rst

Troubleshooting

Docker services won't start

# Manually check/stop services:
docker compose ps
docker compose down

Can't find matching suites

  • Verify the file path is correct
  • Check tests/suitespec.yml to understand suite patterns
  • Your file might not be covered by any suite pattern yet

Test takes too long

  • You may have selected too many venvs
  • Try running with just 1 venv
  • Use pytest -k to run subset of tests

Technical Details

Architecture

The scripts/run-tests system:

  • Maps source files to test suites using patterns in tests/suitespec.yml
  • Uses riot to manage multiple Python/package combinations as venvs
  • Each venv is a self-contained environment
  • Docker services are managed per suite lifecycle
  • Tests can pass optional pytest arguments with --

Supported Suite Types

Primary suites for validation:

  • tracer: Core tracing functionality tests
  • internal: Internal component tests
  • contrib::*: Integration with specific libraries (flask, django, etc.)
  • integration_*: Cross-library integration scenarios
  • Specialized: telemetry, profiling, appsec, llmobs, etc.

Environment Variables

Some suites require environment setup:

  • DD_TRACE_AGENT_URL: For snapshot-based tests
  • Service-specific variables for Docker containers
  • These are handled automatically by the script

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

补充不同宿主或平台的使用分布数据

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

平台分布

trae

29.89%
按下载量换算36

Antigravity

25.41%
按下载量换算30

windsurf

16.46%
按下载量换算20

Claude Code

11.75%
按下载量换算14

Codex

8.27%
按下载量换算10

Gemini CLI

3.96%
按下载量换算5

安全审计

暂无安全审计结果可展示。

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

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

来源信息

继续浏览同类 Skills