Token导航 LogoToken导航TokenDH.com
开发需要联网github未标认证来源可访问许可证需确认审计通过

build-and-test构建和测试

Agent Skill

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

总安装

612

周安装

26

GitHub Stars

10,036

下载量

214
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/microsoft/agent-framework --skill build-and-test

简介

build-and-test 用于协助测试设计与自动化验证,支持单元测试、端到端用例编写及回归检查。

  • 它根据失败日志定位问题,并提供测试框架集成建议,强调真实逻辑保护而非仅通过测试。
  • 使用时需确认项目测试命令和环境配置,区分本地模拟与生产级测试场景。
  • 安装前请确认仓库权限、维护状态,以及是否会执行 npm/yarn 命令或启动浏览器测试。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

  • Only UnitTest projects need to be run locally; IntegrationTests require external dependencies.
  • See ../project-structure/SKILL.md for project structure details.

Build, Test, and Lint Commands

# From dotnet/ directory
dotnet restore --tl:off   # Restore dependencies for all projects
dotnet build --tl:off     # Build all projects
dotnet test               # Run all tests
dotnet format             # Auto-fix formatting for all projects

# Build/test/format a specific project (preferred for isolated/internal changes)
dotnet build src/Microsoft.Agents.AI.<Package> --tl:off
dotnet test --project tests/Microsoft.Agents.AI.<Package>.UnitTests
dotnet format src/Microsoft.Agents.AI.<Package>

# Run a single test
# Replace the filter values with the appropriate assembly, namespace, class, and method names for the test you want to run and use * as a wildcard elsewhere, e.g. "/*/*/HttpClientTests/GetAsync_ReturnsSuccessStatusCode"
# Use `--ignore-exit-code 8` to avoid failing the build when no tests are found for some projects
dotnet test --filter-query "/<assemblyFilter>/<namespaceFilter>/<classFilter>/<methodFilter>" --ignore-exit-code 8

# Run unit tests only
# Use `--ignore-exit-code 8` to avoid failing the build when no tests are found for integration test projects
dotnet test --filter-query "/*UnitTests*/*/*/*" --ignore-exit-code 8

Use --tl:off when building to avoid flickering when running commands in the agent.

Speeding Up Builds and Testing

The full solution is large. Use these shortcuts:

Change typeWhat to do
Isolated/Internal logicBuild only the affected project and its *.UnitTests project. Fix issues, then build the full solution and run all unit tests.
Public API surfaceBuild the full solution and run all unit tests immediately.

Example: Building a single code project for all target frameworks

# From dotnet/ directory
dotnet build ./src/Microsoft.Agents.AI.Abstractions

Example: Building a single code project for just.NET 10.

# From dotnet/ directory
dotnet build ./src/Microsoft.Agents.AI.Abstractions -f net10.0

Example: Running tests for a single project using.NET 10.

# From dotnet/ directory
dotnet test --project ./tests/Microsoft.Agents.AI.Abstractions.UnitTests -f net10.0

Example: Running a single test in a specific project using.NET 10. Provide the full namespace, class name, and method name for the test you want to run:

# From dotnet/ directory
dotnet test --project ./tests/Microsoft.Agents.AI.Abstractions.UnitTests -f net10.0 --filter-query "/*/Microsoft.Agents.AI.Abstractions.UnitTests/AgentRunOptionsTests/CloningConstructorCopiesProperties"

Multi-target framework tip

Most projects target multiple.NET frameworks. If the affected code does not use #if directives for framework-specific logic, pass -f net10.0 to speed up building and testing.

Package Restore tip

dotnet build will try and restore packages for all projects on each build, which can be slow. Unless packages have been changed, or it's the first time building the solution, add --no-restore to the build command to skip this step and speed up builds.

Just remember to run dotnet restore after pulling changes, making changes to project references, or when building for the first time.

Testing on Linux tip

Unit tests target both.NET Framework as well as.NET Core. When running on Linux, only the.NET Core tests can be run, as.NET Framework is not supported on Linux.

To run only the.NET Core tests, use the -f net10.0 option with dotnet test.

Microsoft Testing Platform (MTP)

Tests use the Microsoft Testing Platform via xUnit v3. Key differences from the legacy VSTest runner:

  • dotnet test requires --project to specify a test project directly (positional arguments are no longer supported).
  • Test output uses the MTP format (e.g., [✓112/x0/↓0] progress and Test run summary: Passed!).
  • TRX reports use --report-xunit-trx instead of --logger trx.
  • Code coverage uses Microsoft.Testing.Extensions.CodeCoverage with --coverage --coverage-output-format cobertura.
  • Running a test project directly is supported via dotnet run --project <test-project>. This bypasses the dotnet test infrastructure and runs the test executable directly with the MTP command line.
  • Running tests across the solution with a filter may cause some projects to match zero tests, which MTP treats as a failure (exit code 8). Use --ignore-exit-code 8 to suppress this:
# Run all unit tests across the solution, ignoring projects with no matching tests
dotnet test --solution ./agent-framework-dotnet.slnx --no-build -f net10.0 --ignore-exit-code 8
  • Running tests with --solution for a specific TFM requires all projects in the solution to support that TFM. Not all projects target every framework (e.g., some are net10.0-only). Use ./dotnet/eng/scripts/New-FilteredSolution.ps1 to generate a filtered solution:
# Generate a filtered solution for net472 and run tests
$filtered = ./dotnet/eng/scripts/New-FilteredSolution.ps1 -Solution dotnet/agent-framework-dotnet.slnx -TargetFramework net472
dotnet test --solution $filtered --no-build -f net472 --ignore-exit-code 8

# Exclude samples and keep only unit test projects
./dotnet/eng/scripts/New-FilteredSolution.ps1 -Solution dotnet/agent-framework-dotnet.slnx -TargetFramework net10.0 -ExcludeSamples -TestProjectNameFilter "*UnitTests*" -OutputPath dotnet/filtered-unit.slnx
# Run tests via dotnet test (uses MTP under the hood)
dotnet test --project ./tests/Microsoft.Agents.AI.UnitTests -f net10.0

# Run tests with code coverage (Cobertura format)
dotnet test --project ./tests/Microsoft.Agents.AI.UnitTests -f net10.0 --coverage --coverage-output-format cobertura --coverage-settings ./tests/coverage.runsettings

# Run tests directly via dotnet run (MTP native command line)
dotnet run --project ./tests/Microsoft.Agents.AI.UnitTests -f net10.0

# Show MTP command line help
dotnet run --project ./tests/Microsoft.Agents.AI.UnitTests -f net10.0 -- -?

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

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

平台分布

Codex

35.63%
按下载量换算76

Claude

29.3%
按下载量换算63

Cursor

19.54%
按下载量换算42

Gemini CLI

9.43%
按下载量换算20

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

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

安装前确认

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

来源信息

继续浏览同类 Skills