public void InitRunner(List <TestComponent> tests, List <string> dynamicTestsToRun) { m_CurrentlyRegisteredLogCallback = GetLogCallbackField(); m_LogCallback = LogHandler; Application.RegisterLogCallback(m_LogCallback); // Init dynamic tests foreach (var typeName in dynamicTestsToRun) { var t = Type.GetType(typeName); if (t == null) { continue; } var scriptComponents = Resources.FindObjectsOfTypeAll(t) as MonoBehaviour[]; if (scriptComponents.Length == 0) { Debug.LogWarning(t + " not found. Skipping."); continue; } if (scriptComponents.Length > 1) { Debug.LogWarning("Multiple GameObjects refer to " + typeName); } tests.Add(scriptComponents.First().GetComponent <TestComponent>()); } // create test structure m_TestComponents = ParseListForGroups(tests).ToList(); // create results for tests m_ResultList = m_TestComponents.Select(component => new TestResult(component)).ToList(); // init test provider m_TestsProvider = new IntegrationTestsProvider(m_ResultList.Select(result => result.TestComponent as ITestComponent)); m_ReadyToRun = true; }
public void InitRunner(List <TestComponent> tests, List <string> dynamicTestsToRun) { Debug.Log("InitRunner"); Application.logMessageReceived += LogHandler; foreach (string item in dynamicTestsToRun) { Type type = Type.GetType(item); if (type == null) { continue; } MonoBehaviour[] array = Resources.FindObjectsOfTypeAll(type) as MonoBehaviour[]; if (array.Length == 0) { Debug.LogWarning(string.Concat(type, " not found. Skipping.")); continue; } if (array.Length > 1) { Debug.LogWarning("Multiple GameObjects refer to " + item); } tests.Add(array.First().GetComponent <TestComponent>()); } m_TestComponents = ParseListForGroups(tests).ToList(); m_ResultList = m_TestComponents.Select((TestComponent component) => new TestResult(component)).ToList(); m_TestsProvider = new IntegrationTestsProvider(((IEnumerable <TestResult>)m_ResultList).Select((Func <TestResult, ITestComponent>)((TestResult result) => result.TestComponent))); m_ReadyToRun = true; }
public void InitRunner(List <ITestComponent> tests) { Application.RegisterLogCallback(LogHandler); var testComponents = ParseListForGroups(tests).ToList(); testToRun = testComponents.Select(component => new TestResult(component.gameObject)).ToList(); testsProvider = new IntegrationTestsProvider(testToRun.Select(result => result.TestComponent as ITestComponent)); readyToRun = true; }