I am trying to debug some weird scenario where the RunFinished callback is not called.
I saw a bugfix related to this in v1.3.2, i am wondering if it’s the same case - Changelog | Test Framework | 1.3.9
In our project, we are executing tests using the TestRunnerApi class, once tests are done, we proceed to building the player.
This is setup using the callbacks object, and we rely on the RunFinished method to be invoked so we know all test execution completed.
In some cases i saw recently, our listener is not invoked (i do see the code coverage listener being called and the coverage report being created), but our listener is never called in that case, and the build process just halts until timing out.
Can you please let me know if this sounds like the bug that was already solved ? what is the root cause ? and is there any way to work around it (without upgrading UTF) ?
Just a wild guess: is your callback listener garbage collected because the domain is reloaded during tests? You may need to make it a ScriptableObject and mark it as DontDestroyOnLoad. Alternatively, registering in InitializeOnLoad should, of course, be just as valid.
But in the end it will probably need a repro project for Unity QA, I don’t think the devs monitor/recognize the individual changes here in the forum. Maybe check a newer and older version for them first.
@Xarbrough_1 i am 99% sure it’s garbage collected, although it’s not clear why it started happening all of a sudden.
We registered it in [InitializeOnLoad] and it works now.
Our build process basically sets scripting define symbols and then proceeds to run tests.
Scripting defines causes a re-compilation, so i guess the AppDomain is reloaded and all listeners are lost.
Just not clear why it started happening now.
I have a more stable workaround for anyone who is still having this issue. I got it working using an attribute on top of the class that makes Unity recognize it automatically.
[assembly: TestRunCallback(typeof(TesterCallbacks))]
Here I’ve uploaded an example:
1 Like