Skip to content

第一次原生测试 ​

用 Unreal Engine 5.8 跑一个引擎自带的 Automation 用例。这个示例不需要 MCP 插件,也不需要编写测试代码。

准备示例 ​

安装 CLI 后,从 BlankBlueprint 下载 BlankBlueprint.uproject 和 profile.json,放到同一目录。已检出仓库时,直接使用 Examples\BlankBlueprint。在 PowerShell 中进入这两个文件所在的目录,保存并关闭该工程的编辑器。

运行并核对结果 ​

powershell
$profile = '.\profile.json'
ueagent doctor --profile $profile

确认 engine 指向 UE 5.8,再运行测试。profile.json 已指定要执行的用例全名。

powershell
$output = @(ueagent run --native --profile $profile)
$output

第一行是此次运行的目录。看到 PASS 后,可以用独立命令重新核对导出的报告。

powershell
$runDir = $output[0]
$report = Join-Path $runDir 'Automation\index.json'
ueagent check-report $report --test System.Core.Serialization.CbField.None

check-report 应返回 "status": "PASS"。遇到 NOT_RUN 时,确认报告内的测试全名一致。若运行失败,先打开运行目录中的 result.json 和 editor.log。 报告状态说明

换成自己的工程 ​

把下面的路径、测试全名和 Editor target 换成你的值。纯蓝图工程通常可以省略 --target,C++ 工程需要相匹配的 Visual Studio 工具链与 Windows SDK。UBT 会核对已有产物与当前输入,按需编译。

powershell
ueagent run --native --project .\MyGame.uproject --test MyGame.Smoke --target MyGameEditor --timeout 600

要测试带输入和录像的玩法,继续阅读 Scenario 配置。示例的实测环境见支持矩阵。