Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Bug RunFinished callback is not called

Discussion in 'Testing & Automation' started by liortal, Jun 24, 2023.

  1. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    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 - https://docs.unity3d.com/Packages/com.unity.test-framework@1.3/changelog/CHANGELOG.html

    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) ?
     
  2. Xarbrough

    Xarbrough

    Joined:
    Dec 11, 2014
    Posts:
    1,188
    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.
     
  3. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    @Xarbrough 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.
     
  4. KrisDevelopment

    KrisDevelopment

    Joined:
    Jul 26, 2015
    Posts:
    37
    Last edited: Jan 17, 2024
    liortal likes this.