private static void BackgroundSceneChangeWatch() { #if UNITY_4_6 || UNITY_4_7 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2 var currentScene = EditorApplication.currentScene; #else var currentScene = UnityEditor.SceneManagement.EditorSceneManager.GetActiveScene().path; #endif if (!s_Instance) { return; } if (s_Instance.m_CurrectSceneName != null && s_Instance.m_CurrectSceneName == currentScene) { return; } if (EditorApplication.isPlayingOrWillChangePlaymode) { return; } TestComponent.DestroyAllDynamicTests(); s_Instance.m_CurrectSceneName = currentScene; s_Instance.m_ResultList.Clear(); s_Instance.RebuildTestList(); }
public void Start() { if (isInitializedByRunner) { return; } if (m_Configurator.sendResultsOverNetwork) { var nrs = m_Configurator.ResolveNetworkConnection(); if (nrs != null) { TestRunnerCallback.Add(nrs); } } TestComponent.DestroyAllDynamicTests(); var dynamicTestTypes = TestComponent.GetTypesWithHelpAttribute(Application.loadedLevelName); foreach (var dynamicTestType in dynamicTestTypes) { TestComponent.CreateDynamicTest(dynamicTestType); } var tests = TestComponent.FindAllTestsOnScene(); InitRunner(tests, dynamicTestTypes.Select(type => type.AssemblyQualifiedName).ToList()); }
public void Start() { // Preventing OnDestroy call with invalid internal state currentTest = null; if (isInitializedByRunner) { return; } if (m_Configurator.sendResultsOverNetwork) { var nrs = m_Configurator.ResolveNetworkConnection(); if (nrs != null) { TestRunnerCallback.Add(nrs); } } TestComponent.DestroyAllDynamicTests(); var dynamicTestTypes = TestComponent.GetTypesWithHelpAttribute(SceneManager.GetActiveScene().name); foreach (var dynamicTestType in dynamicTestTypes) { TestComponent.CreateDynamicTest(dynamicTestType); } var tests = TestComponent.FindAllTestsOnScene(); InitRunner(tests, dynamicTestTypes.Select(type => type.AssemblyQualifiedName).ToList()); }
public void Start() { if (isInitializedByRunner) { return; } if (m_Configurator.sendResultsOverNetwork) { var nrs = m_Configurator.ResolveNetworkConnection(); if (nrs != null) { TestRunnerCallback.Add(nrs); } } TestComponent.DestroyAllDynamicTests(); #if UNITY_4_6 || UNITY_4_7 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2 var loadedLevelName = Application.loadedLevelName; #else var loadedLevelName = UnityEditor.SceneManagement.EditorSceneManager.GetActiveScene().name; #endif var dynamicTestTypes = TestComponent.GetTypesWithHelpAttribute(loadedLevelName); foreach (var dynamicTestType in dynamicTestTypes) { TestComponent.CreateDynamicTest(dynamicTestType); } var tests = TestComponent.FindAllTestsOnScene(); InitRunner(tests, dynamicTestTypes.Select(type => type.AssemblyQualifiedName).ToList()); }
public void Start() { Debug.Log("TestRunner.Start"); if (isInitializedByRunner) { return; } if (m_Configurator.sendResultsOverNetwork) { ITestRunnerCallback testRunnerCallback = m_Configurator.ResolveNetworkConnection(); if (testRunnerCallback != null) { TestRunnerCallback.Add(testRunnerCallback); } } TestComponent.DestroyAllDynamicTests(); IEnumerable <Type> typesWithHelpAttribute = TestComponent.GetTypesWithHelpAttribute(SceneManager.GetActiveScene().name); foreach (Type item in typesWithHelpAttribute) { TestComponent.CreateDynamicTest(item); } List <TestComponent> list = TestComponent.FindAllTestsOnScene(); Debug.Log("Found tests in scene:\n" + string.Join("\n", list.Select((TestComponent t) => t.Name).ToArray())); InitRunner(list, typesWithHelpAttribute.Select((Type type) => type.AssemblyQualifiedName).ToList()); }
public void OnDestroy() { EditorApplication.hierarchyWindowItemOnGUI -= OnHierarchyWindowItemDraw; EditorApplication.update -= BackgroundSceneChangeWatch; EditorApplication.hierarchyWindowChanged -= OnHierarchyChangeUpdate; EditorApplication.playmodeStateChanged -= OnPlaymodeStateChanged; TestComponent.DestroyAllDynamicTests(); }
public void OnDestroy() { EditorApplication.hierarchyWindowItemOnGUI -= OnHierarchyWindowItemDraw; EditorApplication.update -= BackgroundSceneChangeWatch; EditorApplication.hierarchyWindowChanged -= OnHierarchyChangeUpdate; #if UNITY_2017_2_OR_NEWER EditorApplication.playModeStateChanged -= OnPlayModeStateChanged; #else EditorApplication.playmodeStateChanged -= OnPlaymodeStateChanged; #endif TestComponent.DestroyAllDynamicTests(); }
private static void BackgroundSceneChangeWatch() { if (Instance.currectSceneName != null && Instance.currectSceneName == EditorApplication.currentScene) { return; } if (EditorApplication.isPlayingOrWillChangePlaymode) { return; } TestComponent.DestroyAllDynamicTests(); Instance.currectSceneName = EditorApplication.currentScene; Instance.RebuildTestList(); }
private static void BackgroundSceneChangeWatch() { if (!s_Instance) { return; } if (s_Instance.m_CurrectSceneName != null && s_Instance.m_CurrectSceneName == EditorSceneManager.GetActiveScene().name) { return; } if (EditorApplication.isPlayingOrWillChangePlaymode) { return; } TestComponent.DestroyAllDynamicTests(); s_Instance.m_CurrectSceneName = EditorSceneManager.GetActiveScene().name; s_Instance.m_ResultList.Clear(); s_Instance.RebuildTestList(); }
public void Start() { #if UNITY_EDITOR && !IMITATE_BATCH_MODE if (!UnityEditorInternal.InternalEditorUtility.inBatchMode) { return; } #endif TestComponent.DestroyAllDynamicTests(); var dynamicTestTypes = TestComponent.GetTypesWithHelpAttribute(Application.loadedLevelName); foreach (var dynamicTestType in dynamicTestTypes) { TestComponent.CreateDynamicTest(dynamicTestType); } var tests = TestComponent.FindAllTestsOnScene(); InitRunner(tests, dynamicTestTypes.Select(type => type.AssemblyQualifiedName).ToList()); }
private static void BackgroundSceneChangeWatch() { if (!s_Instance) { return; } #if UNITY_5_3_OR_NEWER var currentScene = SceneManager.GetActiveScene().path; #else var currentScene = Application.loadedLevelName; #endif if (s_Instance.m_CurrectSceneName != null && s_Instance.m_CurrectSceneName == currentScene) { return; } if (EditorApplication.isPlayingOrWillChangePlaymode) { return; } TestComponent.DestroyAllDynamicTests(); s_Instance.m_CurrectSceneName = currentScene; s_Instance.m_ResultList.Clear(); s_Instance.RebuildTestList(); }
public override void OnInspectorGUI() { var component = (TestComponent)target; if (component.dynamic && GUILayout.Button("Reload dynamic tests")) { TestComponent.DestroyAllDynamicTests(); Selection.objects = new Object[0]; IntegrationTestsRunnerWindow.selectedInHierarchy = false; return; } if (component.IsTestGroup()) { EditorGUI.BeginChangeCheck(); var newGroupName = EditorGUILayout.TextField(m_GUITestName, component.name); if (EditorGUI.EndChangeCheck()) { component.name = newGroupName; } serializedObject.ApplyModifiedProperties(); return; } serializedObject.Update(); EditorGUI.BeginDisabledGroup(serializedObject.isEditingMultipleObjects); EditorGUI.BeginChangeCheck(); var newName = EditorGUILayout.TextField(m_GUITestName, component.name); if (EditorGUI.EndChangeCheck()) { component.name = newName; } if (component.platformsToIgnore == null) { component.platformsToIgnore = GetListOfIgnoredPlatforms(Enum.GetNames(typeof(TestComponent.IncludedPlatforms)), (int)component.includedPlatforms); } var enumList = Enum.GetNames(typeof(RuntimePlatform)); var flags = GetFlagList(enumList, component.platformsToIgnore); flags = EditorGUILayout.MaskField(m_GUIIncludePlatforms, flags, enumList, EditorStyles.popup); var newList = GetListOfIgnoredPlatforms(enumList, flags); if (!component.dynamic) { component.platformsToIgnore = newList; } EditorGUI.EndDisabledGroup(); EditorGUILayout.PropertyField(m_Timeout, m_GUITimeout); EditorGUILayout.PropertyField(m_Ignored, m_GUIIgnore); EditorGUILayout.PropertyField(m_SucceedAssertions, m_GUISuccedOnAssertions); EditorGUILayout.PropertyField(m_ExpectException, m_GUIExpectException); EditorGUI.BeginDisabledGroup(!m_ExpectException.boolValue); EditorGUILayout.PropertyField(m_ExpectedExceptionList, m_GUIExpectExceptionList); EditorGUILayout.PropertyField(m_SucceedWhenExceptionIsThrown, m_GUISucceedWhenExceptionIsThrown); EditorGUI.EndDisabledGroup(); if (!component.dynamic) { serializedObject.ApplyModifiedProperties(); } }
public override void OnInspectorGUI() { var component = (TestComponent)target; if (component.dynamic) { if (GUILayout.Button("Reload dynamic tests")) { TestComponent.DestroyAllDynamicTests(); Selection.objects = new Object[0]; IntegrationTestsRunnerWindow.selectedInHierarchy = false; GUIUtility.ExitGUI(); return; } EditorGUILayout.HelpBox("This is a test generated from code. No changes in the component will be persisted.", MessageType.Info); } if (component.IsTestGroup()) { EditorGUI.BeginChangeCheck(); var newGroupName = EditorGUILayout.TextField(m_GUITestName, component.name); if (EditorGUI.EndChangeCheck()) { component.name = newGroupName; } serializedObject.ApplyModifiedProperties(); return; } serializedObject.Update(); EditorGUI.BeginDisabledGroup(serializedObject.isEditingMultipleObjects); EditorGUI.BeginChangeCheck(); var newName = EditorGUILayout.TextField(m_GUITestName, component.name); if (EditorGUI.EndChangeCheck()) { component.name = newName; } if (component.platformsToIgnore == null) { component.platformsToIgnore = GetListOfIgnoredPlatforms(Enum.GetNames(typeof(TestComponent.IncludedPlatforms)), (int)component.includedPlatforms); } var enumList = Enum.GetNames(typeof(RuntimePlatform)); var flags = GetFlagList(enumList, component.platformsToIgnore); flags = EditorGUILayout.MaskField(m_GUIIncludePlatforms, flags, enumList, EditorStyles.popup); var newList = GetListOfIgnoredPlatforms(enumList, flags); if (!component.dynamic) { component.platformsToIgnore = newList; } EditorGUI.EndDisabledGroup(); EditorGUILayout.PropertyField(m_Timeout, m_GUITimeout); EditorGUILayout.PropertyField(m_Ignored, m_GUIIgnore); EditorGUILayout.PropertyField(m_SucceedAssertions, m_GUISuccedOnAssertions); EditorGUILayout.PropertyField(m_ExpectException, m_GUIExpectException); EditorGUI.BeginDisabledGroup(!m_ExpectException.boolValue); EditorGUILayout.PropertyField(m_ExpectedExceptionList, m_GUIExpectExceptionList); EditorGUILayout.PropertyField(m_SucceedWhenExceptionIsThrown, m_GUISucceedWhenExceptionIsThrown); EditorGUI.EndDisabledGroup(); if (!component.dynamic) { serializedObject.ApplyModifiedProperties(); } if (GUI.changed) #if UNITY_5_3_OR_NEWER { EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene()); } #else { EditorApplication.MarkSceneDirty(); } #endif }