private static void RunInEditor(List <string> sceneList) { CheckActiveBuildTarget(); NetworkResultsReceiver.StopReceiver(); if (sceneList == null || sceneList.Count == 0) { Debug.Log("No scenes on the list"); EditorApplication.Exit(returnCodeRunError); return; } EditorBuildSettings.scenes = sceneList.Select(s => new EditorBuildSettingsScene(s, true)).ToArray(); EditorApplication.OpenScene(sceneList.First()); GuiHelper.SetConsoleErrorPause(false); var config = new PlatformRunnerConfiguration { resultsDir = GetParameterArgument(k_ResultFileDirParam), ipList = TestRunnerConfigurator.GetAvailableNetworkIPs(), port = PlatformRunnerConfiguration.TryToGetFreePort(), runInEditor = true, }; var settings = new PlayerSettingConfigurator(true); settings.AddConfigurationFile(TestRunnerConfigurator.integrationTestsNetwork, string.Join("\n", config.GetConnectionIPs())); NetworkResultsReceiver.StartReceiver(config); EditorApplication.isPlaying = true; }
private static void BuildAndRun(BuildTarget target, List <string> testScenes, List <string> otherBuildScenes) { var resultFilePath = GetParameterArgument(k_ResultFileDirParam); const int port = 0; var ipList = TestRunnerConfigurator.GetAvailableNetworkIPs(); var config = new PlatformRunnerConfiguration { buildTarget = target, buildScenes = otherBuildScenes, testScenes = testScenes, projectName = "IntegrationTests", resultsDir = resultFilePath, sendResultsOverNetwork = InternalEditorUtility.inBatchMode, ipList = ipList, port = port }; if (Application.platform == RuntimePlatform.WebGLPlayer) { config.sendResultsOverNetwork = false; Debug.Log("You can't use WebPlayer as active platform for running integration tests. Switching to Standalone"); #if UNITY_5_6_OR_NEWER EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.Standalone, BuildTarget.StandaloneWindows); #else EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTarget.StandaloneWindows); #endif } PlatformRunner.BuildAndRunInPlayer(config); }
private static void BuildAndRun(BuildTarget target, List <string> sceneList) { var resultFilePath = GetParameterArgument(k_ResultFileDirParam); const int port = 0; var ipList = TestRunnerConfigurator.GetAvailableNetworkIPs(); var config = new PlatformRunnerConfiguration { buildTarget = target, scenes = sceneList.ToArray(), projectName = "IntegrationTests", resultsDir = resultFilePath, sendResultsOverNetwork = InternalEditorUtility.inBatchMode, ipList = ipList, port = port }; if (Application.isWebPlayer) { config.sendResultsOverNetwork = false; Debug.Log("You can't use WebPlayer as active platform for running integration tests. Switching to Standalone"); EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTarget.StandaloneWindows); } PlatformRunner.BuildAndRunInPlayer(config); }
private static void BuildAndRun(BuildTarget target, List <string> testScenes, List <string> otherBuildScenes) { var resultFilePath = GetParameterArgument(k_ResultFileDirParam); const int port = 0; var ipList = TestRunnerConfigurator.GetAvailableNetworkIPs(); var config = new PlatformRunnerConfiguration { buildTarget = target, buildScenes = otherBuildScenes, testScenes = testScenes, projectName = "IntegrationTests", resultsDir = resultFilePath, sendResultsOverNetwork = InternalEditorUtility.inBatchMode, ipList = ipList, port = port }; // WebPlayer support has been removed since Unity 5.4 // if (Application.isWebPlayer) // { // config.sendResultsOverNetwork = false; // Debug.Log("You can't use WebPlayer as active platform for running integration tests. Switching to Standalone"); // EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTarget.StandaloneWindows); // } PlatformRunner.BuildAndRunInPlayer(config); }
private static void BuildAndRun(BuildTarget target, List <string> testScenes, List <string> otherBuildScenes) { var resultFilePath = GetParameterArgument(k_ResultFileDirParam); const int port = 0; var ipList = TestRunnerConfigurator.GetAvailableNetworkIPs(); var config = new PlatformRunnerConfiguration { buildTarget = target, buildScenes = otherBuildScenes, testScenes = testScenes, projectName = "IntegrationTests", resultsDir = resultFilePath, sendResultsOverNetwork = InternalEditorUtility.inBatchMode, ipList = ipList, port = port }; // Commented out because unused and was trigerring compilation issue // starting at version 2018 //#if !UNITY_2017 // if (Application.isWebPlayer) // { // config.sendResultsOverNetwork = false; // Debug.Log("You can't use WebPlayer as active platform for running integration tests. Switching to Standalone"); // EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTarget.StandaloneWindows); // } //#endif PlatformRunner.BuildAndRunInPlayer(config); }
private static void RunInEditor(List <string> testScenes, List <string> otherBuildScenes) { CheckActiveBuildTarget(); // Steve V. 2016 - This causes exceptions and it's a feature I don't care about //NetworkResultsReceiver.StopReceiver(); if (testScenes == null || testScenes.Count == 0) { Debug.Log("No test scenes on the list"); EditorApplication.Exit(returnCodeRunError); return; } EditorBuildSettings.scenes = (testScenes.Concat(otherBuildScenes).ToList()).Select(s => new EditorBuildSettingsScene(s, true)).ToArray(); EditorApplication.OpenScene(testScenes.First()); GuiHelper.SetConsoleErrorPause(false); var config = new PlatformRunnerConfiguration { resultsDir = GetParameterArgument(k_ResultFileDirParam), ipList = TestRunnerConfigurator.GetAvailableNetworkIPs(), port = PlatformRunnerConfiguration.TryToGetFreePort(), runInEditor = true }; var settings = new PlayerSettingConfigurator(true); settings.AddConfigurationFile(TestRunnerConfigurator.integrationTestsNetwork, string.Join("\n", config.GetConnectionIPs())); // Steve V. 2016 - This causes exceptions and it's a feature I don't care about //NetworkResultsReceiver.StartReceiver(config); EditorApplication.isPlaying = true; }
private static void RunInEditor(List <string> testScenes, List <string> otherBuildScenes) { CheckActiveBuildTarget(); NetworkResultsReceiver.StopReceiver(); if (testScenes == null || testScenes.Count == 0) { Debug.Log("No test scenes on the list"); EditorApplication.Exit(returnCodeRunError); return; } string previousScenesXml = ""; var serializer = new System.Xml.Serialization.XmlSerializer(typeof(EditorBuildSettingsScene[])); using (StringWriter textWriter = new StringWriter()) { serializer.Serialize(textWriter, EditorBuildSettings.scenes); previousScenesXml = textWriter.ToString(); } EditorBuildSettings.scenes = (testScenes.Concat(otherBuildScenes).ToList()).Select(s => new EditorBuildSettingsScene(s, true)).ToArray(); #if UNITY_5_3_OR_NEWER EditorSceneManager.OpenScene(testScenes.First()); #else EditorApplication.LoadLevelInPlayMode(testScenes.First()); #endif GuiHelper.SetConsoleErrorPause(false); var config = new PlatformRunnerConfiguration { resultsDir = GetParameterArgument(k_ResultFileDirParam), ipList = TestRunnerConfigurator.GetAvailableNetworkIPs(), port = PlatformRunnerConfiguration.TryToGetFreePort(), runInEditor = true }; var settings = new PlayerSettingConfigurator(true); settings.AddConfigurationFile(TestRunnerConfigurator.integrationTestsNetwork, string.Join("\n", config.GetConnectionIPs())); settings.AddConfigurationFile(TestRunnerConfigurator.testScenesToRun, string.Join("\n", testScenes.ToArray())); settings.AddConfigurationFile(TestRunnerConfigurator.previousScenes, previousScenesXml); NetworkResultsReceiver.StartReceiver(config); EditorApplication.isPlaying = true; }
private static void BuildAndRun(BuildTarget target, List <string> testScenes, List <string> otherBuildScenes) { var resultFilePath = GetParameterArgument(k_ResultFileDirParam); const int port = 0; var ipList = TestRunnerConfigurator.GetAvailableNetworkIPs(); var config = new PlatformRunnerConfiguration { buildTarget = target, buildScenes = otherBuildScenes, testScenes = testScenes, projectName = "IntegrationTests", resultsDir = resultFilePath, sendResultsOverNetwork = InternalEditorUtility.inBatchMode, ipList = ipList, port = port }; PlatformRunner.BuildAndRunInPlayer(config); }