Search Unity

Feature Request Warnings for non-yield-instructions yielded in play mode tests?

Discussion in 'Testing & Automation' started by sbergen, Apr 7, 2021.

  1. sbergen

    sbergen

    Joined:
    Jan 12, 2015
    Posts:
    53
    Could the test runner log a warning if something that is yielded from a [UnityTest] method is not null or a proper yield instruction?

    When using a custom async library (e.g. UniRx or Responsible), it's relatively easy to forget to call ToYieldInstruction(), or similar method, causing tests to not run properly.

    I'm posting in Testing & Automation, as this is where I've seen this issue mostly, but to be honest, this could be a core engine feature also. However, the bug with nested coroutines in tests and lack of async/await support in tests makes this issue even worse.