public void TestModuleBatchedRuns()

in BoostTestAdapterNunit/BoostTestExecutorTest.cs [886:949]


        public void TestModuleBatchedRuns()
        {
            this.RunContext.RegisterSettingProvider(BoostTestAdapterSettings.XmlRootName, new BoostTestAdapterSettingsProvider());
            this.RunContext.LoadSettings("<RunSettings><BoostTest><TestBatchStrategy>Source</TestBatchStrategy></BoostTest></RunSettings>");

            string OtherSource = "OtherSource";
            string YetAnotherSource = "YetAnotherSource";
            
            List<string> sources = new List<string> { DefaultSource, OtherSource, YetAnotherSource };

            this.TestCaseProvider = (string source) =>
            {
                IEnumerable<VSTestCase> tests = GetTests(source);

                if (!tests.Any())
                {
                    if (source == OtherSource)
                    {
                        // 10 tests in 2 suites
                        List<string> fullyQualifiedNames = new List<string> {
                             "Suite1/Test1", "Suite1/Test2" , "Suite1/Test3" , "Suite1/Test4" , "Suite1/Test5"
                            ,"Suite2/Test1", "Suite2/Test2" , "Suite2/Test3" , "Suite2/Test4" , "Suite2/Test5"
                        };

                        return GenerateTestCases(fullyQualifiedNames, OtherSource);
                    }

                    if (source == YetAnotherSource)
                    {
                        // 5 tests in 2 suites
                        List<string> fullyQualifiedNames = new List<string> {
                             "Suite1/Test1", "Suite1/Test2" , "Suite1/Test3" , "Suite2/Test1" , "Suite2/Test2"
                        };

                        return GenerateTestCases(fullyQualifiedNames, YetAnotherSource);
                    }
                }

                return tests;
            };
            
            this.Executor.RunTests(
                sources,
                this.RunContext,
                this.FrameworkHandle
            );

            // One runner per source be provisioned for the available source
            foreach (IBoostTestRunner runner in this.RunnerFactory.ProvisionedRunners)
            {
                Assert.That(runner, Is.TypeOf<MockBoostTestRunner>());
                MockBoostTestRunner testRunner = (MockBoostTestRunner)runner;
                
                // 1 Module/Source -> 1 Execution for all contained tests within
                Assert.That(testRunner.RunCount, Is.EqualTo(1));

                Assert.That(sources.Remove(runner.Source), Is.True);

                // No tests should be specified on the command line implying all tests are to be executed
                Assert.That(testRunner.ExecutionArgs.First().Arguments.Tests.Count, Is.EqualTo(0));
            }

            Assert.That(sources, Is.Empty);
        }