public void Load1000TestsUsingTestLoader()
 {
     loader = new TestLoader();
     int start = Environment.TickCount;
     loader.LoadProject("loadtest-assembly.dll");
     Assert.IsTrue(loader.IsProjectLoaded);
     loader.LoadTest();
     Assert.IsTrue(loader.IsTestLoaded);
     Assert.AreEqual(1000, loader.TestCount);
     int ms = Environment.TickCount - start;
     Assert.LessOrEqual(ms, 4000);
 }
    public void OnEnable()
    {
        passedTexture  = (Texture)AssetDatabase.LoadAssetAtPath("Assets/Plugins/Editor/UniTest/Textures/RunState-Passed.psd", typeof(Texture));
        pendingTexture = (Texture)AssetDatabase.LoadAssetAtPath("Assets/Plugins/Editor/UniTest/Textures/RunState-Pending.psd", typeof(Texture));
        failedTexture  = (Texture)AssetDatabase.LoadAssetAtPath("Assets/Plugins/Editor/UniTest/Textures/RunState-Failed.psd", typeof(Texture));
        notRunTexture  = (Texture)AssetDatabase.LoadAssetAtPath("Assets/Plugins/Editor/UniTest/Textures/RunState-NotRun.psd", typeof(Texture));

        ServiceManager.Services.ClearServices();
        ServiceManager.Services.AddService(new DomainManager());
        ServiceManager.Services.AddService(new RecentFilesService());
        ServiceManager.Services.AddService(new ProjectService());
        ServiceManager.Services.AddService(new TestLoader(new GuiTestEventDispatcher()));
        ServiceManager.Services.AddService(new AddinRegistry());
        ServiceManager.Services.AddService(new AddinManager());
        ServiceManager.Services.AddService(new TestAgency());

        ServiceManager.Services.InitializeServices();

        Services.UserSettings.SaveSetting("Options.TestLoader.ReloadOnChange", true);

        loader = Services.TestLoader;
        loader.Events.ProjectLoadFailed += (path, e) => {
            Debug.Log(e);
            Debug.Log(e.Exception.Message);
            Debug.Log(e.Exception.StackTrace);
        };
        var assembly = System.Reflection.Assembly.GetAssembly(typeof(UniTestEditorRunner));

        loader.Events.TestLoadFailed += (file, exception) => {
            Debug.Log(file);
            Debug.Log(exception);
            Debug.Log(exception.Exception.Message);
            Debug.Log(exception.Exception.StackTrace);
        };

        loader.LoadProject(assembly.Location);
        var factory = new InProcessTestRunnerFactory();
        var package = new TestPackage(assembly.Location);
        package.Settings["DomainUsage"] = DomainUsage.None;
        testRunner = factory.MakeTestRunner(package);
        testRunner.Load(package);

        suite = BuildTestSuiteHierarchy(testRunner.Test);
    }