跳过主要内容
GDT
Skill免费GameSkill 出品 · 调优版

Godot Headless Testing

/godot-gdscript-headless-testing

Run GDScript test suites from the command line with `godot --headless`, using a SceneTree/MainLoop runner script that exits non-zero on failure so CI can gate merges.

许可证
Apache-2.0
出品
GameSkill 出品
下载 ZIP

所属合集

Awesome Gamedev Agent Skills

77 portable SKILL.md skills across 12 engines (Godot, Unity, Unreal, Phaser, PixiJS, three.js, Bevy, pygame, LÖVE, Roblox, Defold, Ebitengine), with a router.

我们测过

在 Godot 4.7.2 上通过 26/26 项检查(2026-10-30):能触发、有可运行示例、有截图和自检清单、单一职责、中英文文档齐全。触发检查是把提示词和 skill 描述做匹配,不是真实 agent 运行。

测试报告

这个 skill 做什么

什么时候触发

Run GDScript test suites from the command line with `godot --headless`, using a SceneTree/MainLoop runner script that exits non-zero on failure so CI can gate merges. …

GameSkill 测过的版本

GameSkill 调优版:skill 文件取自提交 19d93f97c9c1,按我们的 skill 流程加上可运行示例、测试报告、自检清单和中文指南。

下载测过的 ZIP(37 KB)路线图:发布与运营

协议:基于 gamedev-skills/awesome-gamedev-agent-skills(作者 gamedev-skills),协议 Apache-2.0。ZIP 保留协议文件(LICENSE, NOTICE),CHANGES.md 列出了 GameSkill 加的所有文件。

Godot Headless Testing

自检清单

  • 运行器自己数通过和失败,最后 quit(1 if failed > 0 else 0) / The runner counts results and ends with quit(1 if failed > 0 else 0)
  • 测试里不用裸 assert() / No bare assert() in test runners
  • 每个测试返回 bool,没正常结束的算失败 / Each test returns bool; one that did not finish counts as failed
  • 需要帧或计时器的测试先 await process_frame / Tests that need a frame or timer await process_frame first
  • 新检出先 --import,CI 步骤加超时 / Run --import on a fresh checkout and set a CI step timeout

中文指南

这个 skill 做什么

在命令行用 godot --headless 跑 GDScript 测试并拿到真实的退出码,让 CI 能在测试失败时拦住合并:用 SceneTree 脚本当测试运行器、自己计数并显式 quit(1)、不用裸 assert()、需要帧或计时器的测试先等一帧、新检出的项目先 --import、CI 步骤加超时。

什么时候用

  • 没有测试插件,想在终端跑 GDScript 测试
  • 配 GitHub Actions 让失败的测试拦住合并
  • godot --headless 卡住不退出,或失败了还返回 0

怎么装

下载本页的 ZIP,把 godot-gdscript-headless-testing/ 整个文件夹放进 agent 的 skills 文件夹:Claude Code 用 .claude/skills/,Codex、Gemini CLI、OpenCode 用 .agents/skills/,Cursor 用 .cursor/skills/,Copilot 用 .github/skills/,Windsurf 用 .windsurf/skills/,然后重启 agent。也可以直接对 agent 说:Install the skill from https://gameskill.dev/skills/godot-gdscript-headless-testing/install.md

最小示例

gameskill/examples/ 是一个 Godot 4.7 工程:combo.gd 是被测的小逻辑,runners/ 里有 6 个运行器(通过、失败、运行时错误、异步计时器、裸 assert、class_name),tests/run_tests.gd 像 CI 一样用子进程加超时逐个启动它们,检查退出码和输出。

我们怎么测的

总分 26/26。14 项检查都通过:通过的运行器退出 0,失败的退出 1 且失败后的测试照样跑;测试里出现运行时错误时,靠 skill 说的 -> bool 检查计为失败,去掉这个检查同一次运行会返回 0(证明这个坑是真的);异步计时器测试正常结束;裸 assert() 让进程永远不退出,只能被超时杀掉(退出码 124);--script 用绝对路径也行;把项目复制成一个没有 .godot/ 的新检出,不 --import 时 class_name 运行器失败,--import 之后通过。结果在 gameskill/test-report.json。

搭配

  • godot-export:命令行导出
  • performance-optimization:性能检查
  • godot-nodes-scenes:被测的节点和场景

安装

告诉你的 AI

Install the skill from https://gameskill.dev/skills/godot-gdscript-headless-testing/install.md

GameSkill 测过的版本

测过的版本装到 .claude/skills/
mkdir -p .claude/skills
curl -fsSL https://gameskill.dev/dl/skills/godot-gdscript-headless-testing.zip -o /tmp/gameskill-godot-gdscript-headless-testing.zip
unzip -oq /tmp/gameskill-godot-gdscript-headless-testing.zip -d .claude/skills
rm /tmp/gameskill-godot-gdscript-headless-testing.zip

包含内容

  • Worked steps: Minimal SceneTree test runner with a real exit code; Testing something that needs a frame, a timer, or a signal; CI step (GitHub Actions) that gates on the exit code
  • A pitfalls section with the mistakes to avoid

适合

  • When a Godot project needs unit tests without opening the editor, when wiring a CI job (GitHub Actions or similar) that must fail the build on a failing `.gd` test
  • When a `godot --headless` invocation hangs, opens a window, or exits 0 despite failed assertions

试试这条提示词

提示词
Run my GDScript tests headless in GitHub Actions and fail the build when one fails.

关于这个 Skill

Run GDScript test suites from the command line with godot --headless, using a SceneTree/MainLoop runner script that exits non-zero on failure so CI can gate merges. Use when a Godot project needs unit tests without opening the editor, when wiring a CI job (GitHub Actions or similar) that must fail the build on a failing .gd test, or when a godot --headless invocation hangs, opens a window, or exits 0 despite failed assertions.

From the godot-gdscript-headless-testing SKILL.md in gamedev-skills/awesome-gamedev-agent-skills.

What's inside

  • Minimal SceneTree test runner with a real exit code
  • Testing something that needs a frame, a timer, or a signal
  • CI step (GitHub Actions) that gates on the exit code

常见问题

同赛道 PRO 商业源码$8.25/mo

肉鸽构筑白标起步工程(Godot 4 + Web + 平衡表)

告别空工程从零搭架子!开箱即玩的白标肉鸽构筑商业起步模板(Godot 4 完整工程 + Web 可玩版):含开局三槽赐福、无交叉 DAG 地图、扇形出牌、Boss 半血锁血、篝火/商店删牌、32 位校验防坏档 SaveStore、中英切换、30 牌/18 遗物/15 怪平衡表与 1,000 局 HTML 压测工具。

  • 完整 Godot 4.3+ 工程(打开即 F5 运行,内置防坏档原子 SaveStore + 中英实时切换 LocService)
  • 零构建 Web HTML5 可玩起步版(扇形手牌、2 帧受击闪白、震屏与 Boss 半血锁血全跑通)

基于 gamedev-skills/awesome-gamedev-agent-skills (作者 gamedev-skills,协议 Apache-2.0)。ZIP 里保留原作者的 LICENSE 和 NOTICE,ATTRIBUTION.md 和 CHANGES.md 写明来源提交和 GameSkill 加的内容。

搭配使用

作者标注的相关 Skills,或更适合相邻任务的 Skills。

Awesome Gamedev Agent Skills 中的更多 Skills

查看全部 46 个

相似 skills