Replies: 2 comments 3 replies
-
Hello and happy new year. I don't now what you mean with as simplest example for a test extends GdUnitTestSuite
func test_foo():
var obj = auto_free(load("res://ObjectToTest.gd").new())
assert_that(obj.foo()).is_equal("foo") ObjectToTest.gd extends Node
func foo() -> String:
return "foo"
The easiest way to use the Buildin function is to open the context menu above the function you want to test and select "Create Test". |
Beta Was this translation helpful? Give feedback.
-
If I understand you correctly, you are a beginner in the Godot engine. In Godot there are two ways to instantiate an object. You have to load a class via the classpath, or if you have defined a Regarding your second problem, the |
Beta Was this translation helpful? Give feedback.
-
Started testing GDUnit this week and it took me an age to get the first test running, because I could not find a way to reference the object I was testing. After really carefully looking at the code images in the docs, I finally discovered that I had to add class_name to the gdscript node I was testing, and then I could reference that object in the test.
I think this needs to be made a bit clearer in the tutorial because it nearly made me delete the addon.
Secondly, is this a hard requirement? I'm not necessarily against adding class_name, however it's something I've typically not done with my gdscript code before.
Beta Was this translation helpful? Give feedback.
All reactions