Beispiel #1
0
        public void RunTests(IEnumerable <string> sources, IRunContext runContext, ITestExecutionRecorder testExecutionRecorder)
        {
            Guard.ArgumentNotNull("sources", sources);
            Guard.ArgumentNotNull("runContext", runContext);
            Guard.ArgumentNotNull("testExecutionRecorder", testExecutionRecorder);

            foreach (string source in sources)
            {
                if (VsTestRunner.IsXunitTestAssembly(source))
                {
                    RunTestsInAssembly(source, runContext, testExecutionRecorder);
                }
            }
        }
Beispiel #2
0
        public void RunTests(IEnumerable <TestCase> tests, IRunContext runContext, ITestExecutionRecorder testExecutionRecorder)
        {
            Guard.ArgumentNotNull("tests", tests);
            Guard.ArgumentNotNull("runContext", runContext);
            Guard.ArgumentNotNull("testExecutionRecorder", testExecutionRecorder);

            foreach (var testCaseGroup in tests.GroupBy(tc => tc.Source))
            {
                if (VsTestRunner.IsXunitTestAssembly(testCaseGroup.Key))
                {
                    RunTestsInAssembly(testCaseGroup.Key, runContext, testExecutionRecorder, testCaseGroup);
                }
            }
        }
Beispiel #3
0
        void RunTestsInAssembly(string assemblyFileName, IRunContext ctxt, ITestExecutionRecorder recorder, IEnumerable <TestCase> testCases = null)
        {
            cancelled = false;

            using (var executor = new ExecutorWrapper(assemblyFileName, configFilename: null, shadowCopy: true)) {
                if (testCases == null)
                {
                    testCases = VsTestRunner.GetTestCases(executor).ToArray();
                }

                var logger = new VsRunnerLogger(recorder, testCases, () => cancelled);
                var runner = new TestRunner(executor, logger);

                foreach (var testClass in testCases.Select(tc => new TypeAndMethod(tc.Name))
                         .GroupBy(tam => tam.Type))
                {
                    runner.RunTests(testClass.Key, testClass.Select(tam => tam.Method).ToList());
                }
            }
        }