I had an idea to try to confirm that the collection:/id
pattern in fact works for sending messages into the loaded collection, seems so:
case.GameTestCase_can_send_message_into_a_collection_under_test = function(self)
-- Given
local proxy = "/tests#testproxy1"
self.util.loadCollection(proxy)
self.gassert.receivedMessage(hash("proxy_loaded"))
self.util.initCollection(proxy)
-- When
self.util.sendMessage("undertest:/xunit_is_cool", "create_bullet", { position = vmath.vector3(5, 5, 0) })
-- Then
self.gassert.gameObjectExists(proxy .. "/bullets/instance0") -- works
-- self.gassert.gameObjectExists("undertest:" .. "/bullets/instance0") -- times out
end
DEBUG:SCRIPT: Created bullet: [/instance0]
DEBUG:SCRIPT: Suite: Game Tests Suite
DEBUG:SCRIPT: GameTestCaseTests.GameTestCase_can_send_message_into_a_collection_under_test: OK (0.081s; 6 frames)
DEBUG:SCRIPT: 1 run, 0 failed
Note: self.util.sendMessage(...)
is just a wrapper for msg.post(...)
to happen eventually after the other steps completed.