SuperAPI AI 工具集

run-integration-tests

测试与质量

查看项目

更新于 10-15 21:12

技能介绍

用途:在本地对 .NET MAUI 执行集成测试,验证模板、示例项目和端到端场景,确认代码改动不会破坏模板场景。

主要能力:提供 Run-IntegrationTests.ps1 脚本,按类别运行测试。类别包括 Build(基础模板构建)、WindowsTemplates、macOSTemplates、Blazor(混合模板)、MultiProject、Samples、AOT(macOS 原生 AOT)、RunOnAndroid、RunOniOS。脚本流程为:构建与打包、安装本地工作负载、读取 MAUI_PACKAGE_VERSION、执行 dotnet test。支持 -Category、-TestFilter、-Configuration(默认 Debug)、-SkipBuild、-SkipInstall、-SkipXcodeVersionCheck、-AutoProvision、-ResultsDirectory(默认 artifacts/integration-tests)等参数。

使用方式:首次需先运行 dotnet tool restore,再执行 dotnet cake --target=dotnet 与 dotnet cake --target=dotnet-local-workloads 配置本地 SDK 和工作负载(原 ./build.sh --target=dotnet 写法已失效)。之后可运行 pwsh .github/skills/run-integration-tests/scripts/Run-IntegrationTests.ps1 -Category "WindowsTemplates" 等命令,或直接用 .dotnet\dotnet test 指定过滤器。

适用场景与限制:WindowsTemplates 需 Windows,macOSTemplates/RunOniOS/RunOnAndroid 需 macOS;测试耗时较长(15-60 分钟以上),建议直接在终端手动运行而非通过 Copilot CLI。iOS 整类运行易出现模拟器状态问题,建议逐项执行。结果以 TRX 格式输出到结果目录。