Token导航 LogoToken导航

Agent Skill · 开发

run-tests(运行测试)

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

run-tests 是开发类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为只读;许可证信息还不明确,第三方扫描已通过,按安装量在开发类的 21,746 个 Skill 里排第 4,607。

总安装 7,862周安装 315GitHub Stars 1,490下载 2,545核验 2026-05-01

安装说明

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

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/dotnet/skills --skill run-tests

这个 Skill 是做什么的

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

自动检测并运行 .NET 项目测试,支持过滤器和多框架兼容。适用于执行子集测试、理解 VSTest/MTP 框架差异和迭代开发。通过 GitHub 安装,需确认测试平台和过滤器语法正确性。不涉及测试代码生成或迁移任务,应使用专用测试技能。run-tests 属于开发类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/run-tests

上手步骤

4 步
  1. 1

    确认自己的宿主工具

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

  2. 2

    拿到安装命令

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

  3. 3

    安装后重启宿主

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

  4. 4

    按最小权限试用

    它标注为只读,先用只读任务试一次,确认行为符合预期再扩大使用范围。

常见问题

6 条

run-tests 怎么安装?

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

run-tests 支持哪些 AI 工具?

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

run-tests 需要什么权限?

权限级别是只读。该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

run-tests 是免费的吗?

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

run-tests 用的人多吗?

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

run-tests 安全吗?

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

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

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。
  • 来源仓库有 1,490 星,维护活跃度相对可查。
  • 标注为只读权限,试用阶段不容易误改本地文件。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理开发类任务、又不想每次都手写提示词的人。
  • 只想先试试效果、不希望它改动本地文件的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 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有提醒
run-tests

运行测试 · 本页

7,8621,490只读未明确通过

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

SKILL.md 原文

Run.NET Tests

Detect the test platform and framework, run tests, and apply filters using dotnet test.

When to Use

  • User wants to run tests in a.NET project
  • User needs to run a subset of tests using filters
  • User needs help detecting which test platform (VSTest vs MTP) or framework is in use
  • User wants to understand the correct filter syntax for their setup

When Not to Use

  • User needs to write or generate test code (use writing-mstest-tests for MSTest, or general coding assistance for other frameworks)
  • User needs to migrate from VSTest to MTP (use migrate-vstest-to-mtp)
  • User wants to iterate on failing tests without rebuilding (use mtp-hot-reload)
  • User needs CI/CD pipeline configuration (use CI-specific skills)
  • User needs to debug a test (use debugging skills)

Inputs

InputRequiredDescription
Project or solution pathNoPath to the test project (.csproj) or solution (.sln). Defaults to current directory.
Filter expressionNoFilter expression to select specific tests
Target frameworkNoTarget framework moniker to run against (e.g., net8.0)

Critical Rules — Avoid Cross-Platform Mistakes

These are the most common agent mistakes. Internalize before proceeding:

RuleWhy
Do NOT use --logger trx for MTP projectsMTP uses --report-trx (requires the TrxReport extension package)
Do NOT use --report-trx for VSTest projectsVSTest uses --logger trx
Do NOT use -- --arg on.NET SDK 10+SDK 10+ passes MTP args directly: dotnet test --project. --report-trx
Do NOT omit -- on.NET SDK 8/9 with MTPSDK 8/9 requires the separator: dotnet test -- --report-trx
Do NOT use --filter "ClassName=..." with xUnit v3 on MTPxUnit v3 on MTP uses --filter-class, --filter-method, --filter-trait
Do NOT use bare positional path on SDK 10+Use --project <path> or --solution <path> instead
Do NOT use --blame for MTP projectsMTP uses --blame-crash and --blame-hang-timeout separately (each requires its extension package)
Do NOT use --collect "Code Coverage" for MTPMTP uses --coverage (requires the CodeCoverage extension package)

Workflow

Quick Reference

PlatformSDKCommand pattern
VSTestAnydotnet test [<path>] [--filter <expr>] [--logger trx]
MTP8 or 9dotnet test [<path>] -- <MTP_ARGS>
MTP10+dotnet test --project <path> <MTP_ARGS>

Detection files to always check (in order): global.json -> .csproj -> Directory.Build.props -> Directory.Packages.props

Step 1: Detect the test platform and framework

  1. Run dotnet --version in the project directory to determine the SDK version. This accounts for global.json SDK pinning.
  2. Read global.json — on.NET SDK 10+, "test": {"runner": "Microsoft.Testing.Platform"} is the authoritative MTP signal. If present, the project uses MTP and SDK 10+ syntax (no -- separator).
  3. Read .csproj, Directory.Build.props, and Directory.Packages.props for framework packages and MTP properties. Always check all three files — MTP properties are frequently set in Directory.Build.props rather than individual .csproj files.
  4. For full detection logic (SDK 8/9 signals, framework identification), see the platform-detection skill.

What to look for in each file:

FileLook forIndicates
global.json"test": {"runner": "Microsoft.Testing.Platform"}MTP on SDK 10+
global.json"sdk": {"version": "..."}SDK version (determines -- separator behavior)
.csproj<TestingPlatformDotnetTestSupport>trueMTP on SDK 8/9
.csprojMSTest, xunit.v3, NUnit, TUnit packagesFramework identity
.csprojMicrosoft.NET.Test.Sdk + test adapterVSTest (unless overridden by MTP signals above)
.csproj<TargetFrameworks> (plural)Multi-TFM — may need --framework
Directory.Build.props<TestingPlatformDotnetTestSupport>trueMTP on SDK 8/9 (often set here, not in.csproj)
Directory.Packages.propsCentrally managed test package versionsFramework identity for CPM repos

Quick detection summary:

SignalMeans
global.json has "test": {"runner": "Microsoft.Testing.Platform"}MTP on SDK 10+ — pass args directly, no --
<TestingPlatformDotnetTestSupport>true in csproj or Directory.Build.propsMTP on SDK 8/9 — pass args after --
Neither signal presentVSTest

Step 2: Run tests

VSTest (any.NET SDK version)
dotnet test [<PROJECT> | <SOLUTION> | <DIRECTORY> | <DLL> | <EXE>]

Common flags:

FlagDescription
--framework <TFM>Target a specific framework in multi-TFM projects (e.g., net8.0)
--no-buildSkip build, use previously built output
--filter <EXPRESSION>Run selected tests (see Step 3)
--logger trxGenerate TRX results file
--collect "Code Coverage"Collect code coverage using Microsoft Code Coverage (built-in, always available)
--blameEnable blame mode to detect tests that crash the host
--blame-crashCollect a crash dump when the test host crashes
--blame-hang-timeout <duration>Abort test if it hangs longer than duration (e.g., 5min)
-v <level>Verbosity: quiet, minimal, normal, detailed, diagnostic
MTP with.NET SDK 8 or 9

With <TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport>, dotnet test bridges to MTP but uses VSTest-style argument parsing. MTP-specific arguments must be passed after --:

dotnet test [<PROJECT> | <SOLUTION> | <DIRECTORY> | <DLL> | <EXE>] -- <MTP_ARGUMENTS>
MTP with.NET SDK 10+

With the global.json runner set to Microsoft.Testing.Platform, dotnet test natively understands MTP arguments without --:

dotnet test
    [--project <PROJECT_OR_DIRECTORY>]
    [--solution <SOLUTION_OR_DIRECTORY>]
    [--test-modules <EXPRESSION>]
    [<MTP_ARGUMENTS>]

Examples:

# Run all tests in a project
dotnet test --project path/to/MyTests.csproj

# Run all tests in a directory containing a project
dotnet test --project path/to/

# Run all tests in a solution (sln, slnf, slnx)
dotnet test --solution path/to/MySolution.sln

# Run all tests in a directory containing a solution
dotnet test --solution path/to/

# Run with MTP flags
dotnet test --project path/to/MyTests.csproj --report-trx --blame-hang-timeout 5min
Note: The.NET 10+ dotnet test syntax does not accept a bare positional argument like the VSTest syntax. Use --project, --solution, or --test-modules to specify the target.
Common MTP flags

These flags apply to MTP on both SDK versions. On SDK 8/9, pass after --; on SDK 10+, pass directly.

Built-in flags (always available):

FlagDescription
--no-buildSkip build, use previously built output
--framework <TFM>Target a specific framework in multi-TFM projects
--results-directory <DIR>Directory for test result output
--diagnosticEnable diagnostic logging for the test platform
--diagnostic-output-directory <DIR>Directory for diagnostic log output

Extension-dependent flags (require the corresponding extension package to be registered):

FlagRequiresDescription
--filter <EXPRESSION>Framework-specific (not all frameworks support this)Run selected tests (see Step 3)
--report-trxMicrosoft.Testing.Extensions.TrxReportGenerate TRX results file
--report-trx-filename <FILE>Microsoft.Testing.Extensions.TrxReportSet TRX output filename
--blame-hang-timeout <duration>Microsoft.Testing.Extensions.HangDumpAbort test if it hangs longer than duration (e.g., 5min)
--blame-crashMicrosoft.Testing.Extensions.CrashDumpCollect a crash dump when the test host crashes
--coverageMicrosoft.Testing.Extensions.CodeCoverageCollect code coverage using Microsoft Code Coverage
Some frameworks (e.g., MSTest) bundle common extensions by default. Others may require explicit package references. If a flag is not recognized, check that the corresponding extension package is referenced in the project.
Alternative MTP invocations

MTP test projects are standalone executables. Beyond dotnet test, they can be run directly:

# Build and run
dotnet run --project <PROJECT_PATH>

# Run a previously built DLL
dotnet exec <PATH_TO_DLL>

# Run the executable directly (Windows)
<PATH_TO_EXE>

These alternative invocations accept MTP command line arguments directly (no -- separator needed).

Step 3: Run filtered tests

See the filter-syntax skill for the complete filter syntax for each platform and framework combination. Key points:

  • VSTest (MSTest, xUnit v2, NUnit): dotnet test --filter <EXPRESSION> with =, !=, ~, !~ operators
  • MTP -- MSTest and NUnit: Same --filter syntax as VSTest; pass after -- on SDK 8/9, directly on SDK 10+
  • MTP -- xUnit v3: Uses --filter-class, --filter-method, --filter-trait (not VSTest expression syntax)
  • MTP -- TUnit: Uses --treenode-filter with path-based syntax

Validation

  • Test platform (VSTest or MTP) was correctly identified
  • Test framework (MSTest, xUnit, NUnit, TUnit) was correctly identified
  • Correct dotnet test invocation was used for the detected platform and SDK version
  • Filter expressions used the syntax appropriate for the platform and framework
  • Test results were clearly reported to the user

Common Pitfalls

PitfallSolution
Missing Microsoft.NET.Test.Sdk in a VSTest projectTests won't be discovered. Add <PackageReference Include="Microsoft.NET.Test.Sdk" />
Using VSTest --filter syntax with xUnit v3 on MTPxUnit v3 on MTP uses --filter-class, --filter-method, etc. -- not the VSTest expression syntax
Passing MTP args without -- on.NET SDK 8/9Before.NET 10, MTP args must go after --: dotnet test -- --report-trx
Using -- --arg separator on.NET SDK 10+SDK 10+ passes MTP args directly — do NOT use -- separator
Using --logger trx for MTP or --report-trx for VSTestEach platform has its own TRX flag — check the Critical Rules table
Only checking .csproj for MTP signalsAlways check Directory.Build.props and Directory.Packages.props too — MTP properties are frequently set there
Using bare positional path argument on SDK 10+SDK 10+ requires named flags: --project <path> or --solution <path>

Troubleshooting

Common error messages and how to resolve them:

ErrorCauseFix
No test is available or No test matches the given testcase filterWrong filter syntax for the platform/framework, or tests not discoveredVerify filter syntax matches the platform (see filter-syntax skill). For discovery issues, check that the test SDK and adapter packages are installed
The --report-trx option is unrecognizedMTP extension package not referenced, or using MTP flag on a VSTest projectAdd <PackageReference Include="Microsoft.Testing.Extensions.TrxReport" /> for MTP, or use --logger trx for VSTest
The --blame-hang-timeout option is unrecognizedMissing HangDump extension on MTPAdd <PackageReference Include="Microsoft.Testing.Extensions.HangDump" />
error NETSDK1045: The current.NET SDK does not support targeting.NET X.0SDK version in global.json doesn't match the project's target frameworkUpdate global.json SDK version or install the required SDK
The test runner process exited with non-zero exit codeMTP test host crashed or test failureRun with --blame-crash (MTP) or --blame (VSTest) to collect a crash dump for diagnosis
No test source files were found / No test project founddotnet test can't find a test project in the given pathSpecify the path explicitly: dotnet test <path/to/project.csproj> (VSTest) or dotnet test --project <path> (SDK 10+)
Tests discovered but 0 executedFilter expression matches no testsDouble-check filter property names and values. Common typo: TestCategory (MSTest) vs Category (NUnit) vs trait syntax (xUnit)
Using -- for MTP args on.NET SDK 10+On.NET 10+, MTP args are passed directly: dotnet test --project. --blame-hang-timeout 5min — do NOT use -- --blame-hang-timeout
Multi-TFM project runs tests for all frameworksUse --framework <TFM> to target a specific framework
global.json runner setting ignoredRequires.NET 10+ SDK. On older SDKs, use <TestingPlatformDotnetTestSupport> MSBuild property instead
TUnit --treenode-filter not recognizedTUnit is MTP-only. On.NET SDK 10+ use dotnet test; on older SDKs use dotnet run since VSTest-mode dotnet test does not support TUnit

平台分布

Codex

35.42%
按下载量换算901

Claude

26.45%
按下载量换算673

Cursor

19.56%
按下载量换算498

Gemini CLI

9.32%
按下载量换算237

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

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

继续浏览同类 Skills