作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
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/
我是一名优秀的程序员,十分优秀!