Working with tests in Defold engine


I’m starting a thread about ways to write tests in defold. As a contrubutor, i tend to spend much more time trying to figure out how to write the test for a feature than for the feature itself. Cutting to the chase…

When writing new features in defold, typically many layers are involved. From the bottom implementation layers written in C++, middle methods in the components, higher level glue code for C++ lua interaction and the resource files that would typically be generated by defold.

To test the feature, this whole stack has to be engaged. From what i’ve seen this happens by creating the respective resource files like .go, .script, .sound etc. One can then load the .go file and this triggers a chain of operations by loading dependent resource files like scripts etc.

  • Please confirm/correct/explain the overview presented above.

I would also need help with the following:

  • What’s the proper procedure to add a resource file to a test? How to name it, where to put it, how to iterate when building the test quickly ? For example, i’ve faced situations where i’ve renamed script resource file (both the file and reference in .go) and it couldn’t find it any more. I ended up rebuilding the whole engine.
  • what is the _pb suffix in the resource files? I see files named *.go_pb, *.a_pb etc.
  • what are the .goc files ? .go files compiled ?
  • In existing tests typically the ‘dmGameObject::Update()’ function is called after setting up the environment. Does this end up calling update() in the lua scripts loaded ? Something like running an execution cycle of the engine. Is this correct ?