SuperAPI AI 工具集

run-device-tests

测试与质量

查看项目

更新于 10-16 08:36

技能介绍

用途:在本地构建并运行 .NET MAUI 设备测试,覆盖 iOS 模拟器、MacCatalyst、Android 模拟器与 Windows,并支持按测试类别过滤,便于开发中快速迭代。

平台支持:macOS 可运行 ios、maccatalyst、android;Windows 可运行 android、windows。

主要能力:脚本自动检测并启动 iOS 模拟器或 Android 模拟器,完成构建与测试执行;支持指定 iOS 版本(如 -iOSVersion 26)、仅构建(-BuildOnly)、按类别过滤(-TestFilter "Category=Button" 或 "SkipCategories=Shell,CollectionView")。可用项目包括 Controls、Core、Essentials、Graphics、BlazorWebView。

使用方式:需 bash 与 pwsh(PowerShell 7+),并安装 xharness 全局工具(dotnet tool install --global Microsoft.DotNet.XHarness.CLI)、带平台工作负载的 .NET SDK,以及对应平台 SDK(iOS/MacCatalyst 需 Xcode 与模拟器,Android 需 Android SDK 与模拟器,Windows 需 Windows SDK)。典型命令:pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Controls -Platform ios。构建产物在 artifacts/bin/,测试日志在 artifacts/log/。

适用场景:本地验证 iOS/MacCatalyst/Android/Windows 兼容性、在特定 iOS 版本上测试、只运行某类测试(如 Button)。

限制:iOS 26 需 macOS Tahoe (26) 与 Xcode 26;Xcode 版本不匹配可用 -SkipXcodeVersionCheck 绕过;测试过滤需完整重建才能生效;类别名区分大小写。其余细节暂未提供。