Ejemplo n.º 1
0
        void RunTestsInAssembly(List <IDisposable> toDispose, AssemblyRunInfo runInfo)
        {
            if (cancelled)
            {
                return;
            }

            var assemblyFileName = runInfo.AssemblyFileName;

            var controller = new XunitFrontController(AppDomainSupport.Denied, assemblyFileName);

            lock (toDispose)
                toDispose.Add(controller);


            var xunitTestCases = runInfo.TestCases.Select(tc => new
            {
                vm = tc,
                tc = tc.TestCase
            })
                                 .Where(tc => tc.tc.UniqueID != null)
                                 .ToDictionary(tc => tc.tc, tc => tc.vm);
            var executionOptions = TestFrameworkOptions.ForExecution(runInfo.Configuration);


            using (var executionVisitor = new TestExecutionVisitor(xunitTestCases, this, executionOptions, () => cancelled, context))
            {
                controller.RunTests(xunitTestCases.Select(tc => tc.Value.TestCase).ToList(), executionVisitor, executionOptions);
                executionVisitor.Finished.WaitOne();
            }
        }
Ejemplo n.º 2
0
        // Hmm. testCases is serialised, so can't be an arbitrary IEnumerable<>
        public void RunTests(IList<ITestCase> testCases)
        {
            // If there are no test cases, the Finished event is never set
            Debug.Assert(testCases.Count > 0);

            var options = TestFrameworkOptions.ForExecution(environment.TestAssemblyConfiguration);

            // If the test hosts have requested all concurrency to be disabled, make sure we
            // also make reporting of test messages synchronous. E.g. continuous testing needs
            // to know when a tests starts/finishes. If we report that asynchronously, it can't
            // accurately track what code is affected by which tests
            if (environment.DisableAllConcurrency)
                options.SetSynchronousMessageReporting(true);

            Logger.LogVerbose("Starting execution");
            LogExecutionOptions(options);

            var visitor = new TestExecutionVisitor(runContext);
            executor.RunTests(testCases, visitor, options);
            visitor.Finished.WaitOne();
        }
Ejemplo n.º 3
0
        void RunTestsInAssembly(List<IDisposable> toDispose, AssemblyRunInfo runInfo)
        {
            if (cancelled)
                return;

            var assemblyFileName = runInfo.AssemblyFileName;

            var controller = new XunitFrontController(AppDomainSupport.Denied, assemblyFileName);

            lock (toDispose)
                toDispose.Add(controller);


            var xunitTestCases = runInfo.TestCases.Select(tc => new
            {
                vm = tc,
                tc = tc.TestCase
            })
                                        .Where(tc => tc.tc.UniqueID != null)
                                        .ToDictionary(tc => tc.tc, tc => tc.vm);
            var executionOptions = TestFrameworkOptions.ForExecution(runInfo.Configuration);


            using (var executionVisitor = new TestExecutionVisitor(xunitTestCases, this, executionOptions, () => cancelled, context))
            {
                controller.RunTests(xunitTestCases.Select(tc => tc.Value.TestCase).ToList(), executionVisitor, executionOptions);
                executionVisitor.Finished.WaitOne();
            }
        }
Ejemplo n.º 4
0
        void RunTestsInAssembly(List<IDisposable> toDispose,
                                string assemblyFileName,
                                IEnumerable<TestCaseViewModel> testCases,
                                Stopwatch stopwatch)
        {
            if (cancelled)
                return;

            var controller = new XunitFrontController(assemblyFileName, configFileName: null, shadowCopy: true);

            lock (toDispose)
                toDispose.Add(controller);

            var xunitTestCases = testCases.ToDictionary(tc => tc.TestCase);

            using (var executionVisitor = new TestExecutionVisitor(xunitTestCases, this, () => cancelled, context))
            {
                var executionOptions = TestFrameworkOptions.ForExecution();

                controller.RunTests(xunitTestCases.Keys.ToList(), executionVisitor, executionOptions);
                executionVisitor.Finished.WaitOne();

            }

        }