gpt4 book ai didi

testing - 如何在 Godot 引擎中编写测试

转载 作者:行者123 更新时间:2023-12-03 16:11:12 24 4
gpt4 key购买 nike

Soo 我正在使用 Godot 引擎开发游戏,我想为代码创建一些测试以确保一切正常,我无法通过需要 5-10 分钟的简单操作来测试游戏。有没有办法写测试???

最佳答案

看看GUT ,Godot 单元测试框架,或 WAT .
两者的区别,quoting WAT's author :

  • GUT runs in a scene. WAT runs in the editor itself.
  • GUT (last I checked) cannot handle creating Test Doubles that take constructor dependencies (as in it uses the _init method witharguments).
  • WAT has parameterized testing (so you can do the same test multiple times only needing to define the different set of arguments per runthrough).
  • WAT has a much larger range of asserts (I think)
  • WAT can intentionally crash a test script if one method fails (this isn't documented yet though).
  • WAT cleans up after itself with regards to memory. GUT doesn't. (Note: This was largely thanks to the recent method print_stray_nodesbuiltin to Godot that GUT didn't have during its initial creation).
  • GUT allows for inner test classes. WAT doesn't. However WAT has the "context" attribute attached to every asserts call so you can addsub-context to your describe() method context of the parent method.

关于testing - 如何在 Godot 引擎中编写测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62258753/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com