protected virtual void AddCompornents(Unity3D_TestSuite suite) { // For each assembly in this app domain foreach (Assembly assem in AppDomain.CurrentDomain.GetAssemblies()) { // For each type in the assembly foreach (Type type in assem.GetTypes()) { // If this is a valid test case // i.e. derived from TestCase and instantiable if (typeof(UnityTestCase).IsAssignableFrom(type) && type != typeof(UnityTestCase) && !type.IsAbstract) { // Add tests to suite UnityTestCase test = gameObject.AddComponent(type.Name) as UnityTestCase; suite.AddAll(test); } else if (typeof(TestCase).IsAssignableFrom(type) && type != typeof(TestCase) && !type.IsAbstract) { suite.AddAll(type.GetConstructor(new Type[0]).Invoke(new object[0]) as TestCase); } } } }
/** * Initialize class resources. */ protected virtual IEnumerator Start() { // Create test suite TestResult ret = new TestResult(); Unity3D_TestSuite suite = new Unity3D_TestSuite(this, ret); // Add test cases TestCase[] testcases = this.TestCases; foreach (TestCase tc in testcases) suite.AddAll(tc); // Run the tests yield return StartCoroutine(suite.RunAll()); // Report results Unity3D_TestReporter reporter = new Unity3D_TestReporter(); reporter.LogResults(ret); }
protected override void AddCompornents(Unity3D_TestSuite suite) { suite.AddAll(gameObject.AddComponent("MsgpackTestCase") as UnityTestCase); }