SuperAPI AI 工具集

dotnet-test

测试与质量

查看项目

更新于 10-15 22:16

技能介绍

用途:通过 dotnet CLI 运行 .NET 测试,包括单元测试执行、代码覆盖率报告生成和性能基准测试。适用于使用 xUnit、NUnit 等框架的测试项目,用于验证代码变更、测量测试耗时并获取基准结果;不适用于构建代码、格式化或静态分析。

主要能力:运行全部或指定测试项目;按名称或类别筛选测试;以 Debug/Release 配置执行;使用 coverlet 收集 XPlat Code Coverage 并输出 Cobertura 报告;使用 BenchmarkDotNet 执行基准测试。输入参数包括 target(all/project/specific)、configuration、coverage、project_path;输出为测试结果(成功/失败计数)、覆盖率报告、基准结果及退出码(0 表示成功)。

必要用法示例: cd ./dotnet dotnet test dotnet test --verbosity normal dotnet test console-app.Tests/PigeonPea.Console.Tests.csproj dotnet test --collect:"XPlat Code Coverage" --results-directory ./TestResults dotnet test --filter "FullyQualifiedName~FrameTests" dotnet test --filter "Category=Unit" dotnet test --configuration Release cd ./dotnet/benchmarks dotnet run -c Release

限制与注意事项:仅在 ./dotnet 目录内操作;失败须明确报告,未经允许不得跳过测试。覆盖率未生成时需确认 coverlet.collector 已安装;基准测试须使用 Release 配置;测试发现失败需检查项目引用及测试框架包。加速可考虑筛选、并行或 --no-build。资料未提供该技能的安装命令、收费方式或平台要求。