public void TestTestRunner() { throw new NotImplementedException(); // This causes problems with automated testing TestRunnerGUI runnerGui = new TestRunnerGUI(Assembly.GetExecutingAssembly()); runnerGui.Run(); }
public void OnGUI() { if (UnityTest.TestRunner == this) { GUI.depth = -10; GUILayout.BeginArea(GUITools.FullScreen, "Unit Tests", "window"); viewState = TestRunnerGUI.ShowAggregateResults(viewState, aggregateResults); GUILayout.EndArea(); } }
public void OnGUI() { if (TestRunner == null) { GUI.depth = -10; GUILayout.BeginArea(GUITools.FullScreen, GetType().Name, "window"); scrollPosition = TestRunnerGUI.ShowSuiteResults(scrollPosition, results); GUILayout.EndArea(); } }
private void runWinformsTestrunner() { var treeBuilder = new TestsTreeBuilder(); var builder = new NunitTestsTreeBuilder(treeBuilder); addToTestsTree(builder, "Unit Tests.dll"); addToTestsTree(builder, "../../Gameplay/bin/x86/Debug/Gameplay.dll"); addToTestsTree(builder, "../../Geomipmap.Tests/bin/Debug/Geomipmap.Tests.dll"); TestRunnerGUI runnerGui = new TestRunnerGUI(treeBuilder.RootNode); //runner.RunTestNewProcessPath = "\"" + Assembly.GetExecutingAssembly().Location + "\"" + " -test {0}"; runnerGui.Run(); }
public void OnGUI() { if (UnityTestController.Instance != null) { aggregateResults = UnityTestController.Instance.aggregateResults; } GUILayout.BeginVertical(GUITools.ConstrainedBox); if (UnityTestController.Instance != null) { viewState = TestRunnerGUI.ShowAggregateResults(viewState, aggregateResults); } else if (UnityTest.Instance != null) { viewState.innerScrollPosition = TestRunnerGUI.ShowSuiteResults(viewState.innerScrollPosition, UnityTest.Instance.results); } else { GUILayout.Label("No test data..."); GUILayout.FlexibleSpace(); } GUILayout.EndVertical(); }
public static TestResultsViewState ShowAggregateResults(TestResultsViewState state, ArrayList aggregateResults) { if (state.labels.Length != aggregateResults.Count) { state.labels = new string[aggregateResults.Count]; for (int i = 0; i < state.labels.Length; i++) { SuiteResults sr = ((SuiteResults)(aggregateResults[i])); state.labels[i] = sr.suite.Name + ((sr.variant != null) ? sr.variant : ""); } } GUILayout.BeginHorizontal(GUITools.ConstrainedBox); GUILayout.BeginVertical(); GUITools.TextColorState tcs; state.outerScrollPosition = GUILayout.BeginScrollView(state.outerScrollPosition, false, false, GUILayout.Width(180)); if ((state.labels.Length > 0) && (state.selectedIndex >= 0)) { for (int i = 0; i < state.labels.Length; i++) { SuiteResults sr = ((SuiteResults)(aggregateResults[i])); TestResultStyle style = TestResultStyle.Pass; // TODO: UGH! This SUCKS! We shouldn't have to iterate every // result multiple times every frame!!!! bool isFailed = false; foreach (TestResult r in sr.results) { // If ANY result is ongoing, the result is Ongoing. // If there's no ongoing test AND there is ANY failed test, the // result is Failed. // Otherwise, the result is Passed. if (r.IsRunning) { style = TestResultStyle.Ongoing; if (Application.isPlaying) { state.selectedIndex = i; } break; } else if (r.Passed) { if (!isFailed) { style = TestResultStyle.Pass; } } else { style = TestResultStyle.Fail; isFailed = true; continue; } } tcs = GUITools.SetTextColor(style.color, "button"); if (GUILayout.Toggle((state.selectedIndex == i), state.labels[i], "button", GUILayout.Width(150))) { state.selectedIndex = i; } GUITools.RestoreTextColor(tcs); } } GUILayout.EndScrollView(); GUILayout.EndVertical(); GUILayout.BeginVertical(); if (state.labels.Length > 0) { if (state.selectedIndex >= state.labels.Length) { state.selectedIndex = state.labels.Length - 1; } GUILayout.Label(state.labels[state.selectedIndex]); if ((state.selectedIndex >= 0) && (aggregateResults.Count > 0)) { state.innerScrollPosition = TestRunnerGUI.ShowSuiteResults(state.innerScrollPosition, ((SuiteResults)(aggregateResults[state.selectedIndex])).results); } } GUILayout.EndVertical(); GUILayout.EndHorizontal(); return(state); }
public void TestRunTestByName() { TestRunnerGUI runnerGui = new TestRunnerGUI(Assembly.GetExecutingAssembly()); runnerGui.RunTestByName("MHGameWork.TheWizards.Tests.Utilities.UtilitiesTest.TestSimpleTest"); }