/// <summary>
        /// Load a TestPackage for possible execution
        /// </summary>
        /// <param name="package">The TestPackage to be loaded</param>
        /// <returns>A TestEngineResult.</returns>
        public override TestEngineResult Load(TestPackage package)
        {
            this.package = package;

            List <TestPackage> packages = new List <TestPackage>();

            foreach (string testFile in package.TestFiles)
            {
                TestPackage subPackage = new TestPackage(testFile);
                if (Services.ProjectService.IsProjectFile(testFile))
                {
                    Services.ProjectService.ExpandProjectPackage(subPackage);
                }
                foreach (string key in package.Settings.Keys)
                {
                    subPackage.Settings[key] = package.Settings[key];
                }
                packages.Add(subPackage);
            }

            List <TestEngineResult> results = new List <TestEngineResult>();

            foreach (TestPackage subPackage in packages)
            {
                AbstractTestRunner runner = CreateRunner(subPackage);
                runners.Add(runner);
                results.Add(runner.Load(subPackage));
            }

            return(ResultHelper.Merge(results));
        }
示例#2
0
        private void PerformPackageSetup(TestPackage package)
        {
            this.package = package;

            // Expand projects, updating the count of projects and assemblies
            ExpandProjects();

            // If there is more than one project or a mix of assemblies and
            // projects, AggregatingTestRunner will call MakeTestRunner for
            // each project or assembly.
            this.realRunner = projectCount > 1 || projectCount > 0 && assemblyCount > 0
                ? new AggregatingTestRunner(services)
                : (AbstractTestRunner)services.TestRunnerFactory.MakeTestRunner(package);
        }