Search Unity

Help Wanted calling testRunnerApi.Execute during playmode

Discussion in 'Testing & Automation' started by hmkn, May 10, 2021.

  1. hmkn

    hmkn

    Joined:
    Nov 7, 2019
    Posts:
    23
    Hi. Is it possible to use testRunnerApi.Execute method during Play Mode?
    I'd like to call test method when entering specific state in playmode.
    I have encountered these errors when calling Execute through unity test runner.

    Code (log):
    1. InvalidOperationException: This cannot be used during play mode.
    2. UnityEditor.TestTools.TestRunner.TestRun.Tasks.SaveModiedSceneTask+<Execute>d__1.MoveNext () (at Library/PackageCache/com.unity.test-framework@1.1.19/UnityEditor.TestRunner/TestRun/Tasks/SaveModiedSceneTask.cs:13)
    3. UnityEditor.TestTools.TestRunner.TestRun.TestJobRunner.ExecuteStep () (at Library/PackageCache/com.unity.test-framework@1.1.19/UnityEditor.TestRunner/TestRun/TestJobRunner.cs:124)
    4. UnityEditor.EditorApplication:Internal_CallUpdateFunctions() (at /Users/bokken/buildslave/unity/build/Editor/Mono/EditorApplication.cs:327)
     
unityunity