public override void Run() { var editorConnectionTestCollector = RemoteTestRunController.instance; editorConnectionTestCollector.hideFlags = HideFlags.HideAndDontSave; editorConnectionTestCollector.Init(m_TargetPlatform, m_HeartbeatTimeout); var remotePlayerLogController = RemotePlayerLogController.instance; remotePlayerLogController.hideFlags = HideFlags.HideAndDontSave; using (var settings = new PlayerLauncherContextSettings(m_OverloadTestRunSettings)) { m_SceneName = CreateSceneName(); var scene = PrepareScene(m_SceneName); string scenePath = scene.path; var filter = m_Settings.BuildNUnitFilter(); var runner = LoadTests(filter); var exceptionThrown = ExecutePreBuildSetupMethods(runner.LoadedTest, filter); if (exceptionThrown) { ReopenOriginalScene(m_Settings.originalScene); AssetDatabase.DeleteAsset(m_SceneName); CallbacksDelegator.instance.RunFailed("Run Failed: One or more errors in a prebuild setup. See the editor log for details."); return; } var playerBuildOptions = GetBuildOptions(scenePath); var success = BuildAndRunPlayer(playerBuildOptions); editorConnectionTestCollector.PostBuildAction(); ExecutePostBuildCleanupMethods(runner.LoadedTest, filter); ReopenOriginalScene(m_Settings.originalScene); AssetDatabase.DeleteAsset(m_SceneName); if (!success) { editorConnectionTestCollector.CleanUp(); ScriptableObject.DestroyImmediate(editorConnectionTestCollector); Debug.LogError("Player build failed"); throw new TestLaunchFailedException("Player build failed"); } if ((playerBuildOptions.BuildPlayerOptions.options & BuildOptions.AutoRunPlayer) != 0) { editorConnectionTestCollector.PostSuccessfulBuildAction(); editorConnectionTestCollector.PostSuccessfulLaunchAction(); } var runSettings = m_OverloadTestRunSettings as PlayerLauncherTestRunSettings; if (success && runSettings != null && runSettings.buildOnly) { EditorUtility.RevealInFinder(playerBuildOptions.BuildPlayerOptions.locationPathName); } } }
public override void Run() { var editorConnectionTestCollector = RemoteTestRunController.instance; editorConnectionTestCollector.hideFlags = HideFlags.HideAndDontSave; editorConnectionTestCollector.Init(m_TargetPlatform); var remotePlayerLogController = RemotePlayerLogController.instance; remotePlayerLogController.hideFlags = HideFlags.HideAndDontSave; using (var settings = new PlayerLauncherContextSettings(m_OverloadTestRunSettings)) { var sceneName = CreateSceneName(); var scene = PrepareScene(sceneName); var filter = m_Settings.filter.BuildNUnitFilter(); var runner = LoadTests(filter); var exceptionThrown = ExecutePreBuildSetupMethods(runner.LoadedTest, filter); if (exceptionThrown) { ReopenOriginalScene(m_Settings.originalScene); AssetDatabase.DeleteAsset(sceneName); CallbacksDelegator.instance.RunFailed("Run Failed: One or more errors in a prebuild setup. See the editor log for details."); return; } var playerBuildOptions = GetBuildOptions(scene); var success = BuildAndRunPlayer(playerBuildOptions); editorConnectionTestCollector.PostBuildAction(); ExecutePostBuildCleanupMethods(runner.LoadedTest, filter); ReopenOriginalScene(m_Settings.originalScene); AssetDatabase.DeleteAsset(sceneName); if (!success) { ScriptableObject.DestroyImmediate(editorConnectionTestCollector); Debug.LogError("Player build failed"); throw new TestLaunchFailedException("Player build failed"); } editorConnectionTestCollector.PostSuccessfulBuildAction(); } }