static Filter[] GetFilters(ExecutionSettings executionSettings)
        {
            if (executionSettings.filters != null && executionSettings.filters.Length > 0)
            {
                return(executionSettings.filters);
            }

            return(new[] { executionSettings.filter ?? new Filter() });
        }
Exemple #2
0
        internal void RetrieveTestList(ExecutionSettings executionSettings, Action <ITestAdaptor> callback)
        {
            if (executionSettings == null)
            {
                throw new ArgumentNullException(nameof(executionSettings));
            }

            var firstFilter = executionSettings.filters?.FirstOrDefault() ?? executionSettings.filter;

            RetrieveTestList(firstFilter.testMode, callback);
        }
 internal TestLauncherBase GetLauncher(ExecutionSettings executionSettings)
 {
     if (executionSettings.filter.testMode == TestMode.EditMode)
     {
         return(GetEditModeLauncher(executionSettings.filter));
     }
     else
     {
         var settings = PlaymodeTestsControllerSettings.CreateRunnerSettings(executionSettings.filter.ToTestRunnerFilter());
         return(GetPlayModeLauncher(settings, executionSettings));
     }
 }
        internal TestLauncherBase GetLauncher(ExecutionSettings executionSettings)
        {
            var filters = GetFilters(executionSettings);

            if (filters[0].testMode == TestMode.EditMode)
            {
                return(GetEditModeLauncher(GetFilters(executionSettings)));
            }
            else
            {
                var settings = PlaymodeTestsControllerSettings.CreateRunnerSettings(filters.Select(filter => filter.ToTestRunnerFilter()).ToArray());
                return(GetPlayModeLauncher(settings, executionSettings));
            }
        }
        public void Execute(ExecutionSettings executionSettings)
        {
            if (executionSettings == null)
            {
                throw new ArgumentException("Filter for execution is undefined.");
            }

            var launcherFactory = new TestLauncherFactory();
            var data            = TestRunData.instance;

            data.executionSettings = executionSettings;

            var testLauncher = launcherFactory.GetLauncher(executionSettings);

            testLauncher.Run();
        }
        public TestLauncherBase GetLauncher(ExecutionSettings executionSettings)
        {
            var filters = GetFilters(executionSettings);

            if (filters[0].testMode == TestMode.EditMode || filters[0].testMode == 0)
            {
                return(GetEditModeLauncher(GetFilters(executionSettings), executionSettings.runSynchronously));
            }
            else
            {
                if (executionSettings.runSynchronously)
                {
                    throw new NotSupportedException("Playmode tests cannot be run synchronously.");
                }

                var settings = PlaymodeTestsControllerSettings.CreateRunnerSettings(filters.Select(filter => filter.ToTestRunnerFilter()).ToArray());
                return(GetPlayModeLauncher(settings, executionSettings));
            }
        }
Exemple #7
0
        public string Execute(ExecutionSettings executionSettings)
        {
            if (executionSettings == null)
            {
                throw new ArgumentNullException(nameof(executionSettings));
            }

            if ((executionSettings.filters == null || executionSettings.filters.Length == 0) && executionSettings.filter != null)
            {
                // Map filter (singular) to filters (plural), for backwards compatibility.
                executionSettings.filters = new [] { executionSettings.filter };
            }

            if (executionSettings.targetPlatform == null && executionSettings.filters != null &&
                executionSettings.filters.Length > 0)
            {
                executionSettings.targetPlatform = executionSettings.filters[0].targetPlatform;
            }

            return(ScheduleJob(executionSettings));
        }
        public void Execute(ExecutionSettings executionSettings)
        {
            if (executionSettings == null)
            {
                throw new ArgumentNullException(nameof(executionSettings));
            }

            if (executionSettings.targetPlatform == null && executionSettings.filters != null &&
                executionSettings.filters.Length > 0)
            {
                executionSettings.targetPlatform = executionSettings.filters[0].targetPlatform;
            }

            var data = TestRunData.instance;

            data.executionSettings = executionSettings;

            var testLauncher = launcherFactory.GetLauncher(executionSettings);

            testLauncher.Run();
        }
        public void RetrieveTestList(ExecutionSettings executionSettings, Action <ITestAdaptor> callback)
        {
            if (executionSettings == null)
            {
                throw new ArgumentException("Filter for execution is undefined.");
            }

            if (callback == null)
            {
                throw new ArgumentException("Callback is undefined.");
            }

            var platform               = ParseTestMode(executionSettings.filter.testMode);
            var testAssemblyProvider   = new EditorLoadedTestAssemblyProvider(new EditorCompilationInterfaceProxy(), new EditorAssembliesProxy());
            var testAdaptorFactory     = new TestAdaptorFactory();
            var testListCache          = new TestListCache(testAdaptorFactory, new RemoteTestResultDataFactory(), TestListCacheData.instance);
            var testListProvider       = new TestListProvider(testAssemblyProvider, new UnityTestAssemblyBuilder());
            var cachedTestListProvider = new CachingTestListProvider(testListProvider, testListCache, testAdaptorFactory);

            var job = new TestListJob(cachedTestListProvider, platform, callback);

            job.Start();
        }
 static TestLauncherBase GetPlayerLauncher(PlaymodeTestsControllerSettings settings, ExecutionSettings executionSettings)
 {
     return(new PlayerLauncher(
                settings,
                executionSettings.targetPlatform.Value,
                executionSettings.overloadTestRunSettings));
 }
        static TestLauncherBase GetPlayModeLauncher(PlaymodeTestsControllerSettings settings, ExecutionSettings executionSettings)
        {
            if (executionSettings.targetPlatform != null)
            {
                return(GetPlayerLauncher(settings, executionSettings));
            }

            if (PlayerSettings.runPlayModeTestAsEditModeTest)
            {
                return(GetEditModeLauncherForProvidedAssemblies(executionSettings.filters, TestPlatform.PlayMode, false));
            }

            return(GetPlayModeLauncher(settings));
        }