Пример #1
0
        public void RunTests(IEnumerable<TestCase> tests, IRunContext runContext, IFrameworkHandle frameworkHandle)
        {
            var settingsProvider =
                runContext.RunSettings.GetSettings(VSTestSettings.SettingsName) as VSTestSettingsService;

            VSTestSettings settings;
            if (settingsProvider != null)
            {
                frameworkHandle.SendMessage(TestMessageLevel.Informational, "Found settings.");
                settings = settingsProvider.Settings;
            }
            else
            {
                frameworkHandle.SendMessage(TestMessageLevel.Informational, "No settings found. Using defaults.");
                settings = new VSTestSettings();
            }

            frameworkHandle.SendMessage(TestMessageLevel.Informational, settings.WorkingDirectory);

            _frameworkHandle = frameworkHandle;

            ITestLogger logger = new VSLogger(frameworkHandle);

            GTestConverter converter = new GTestConverter();
            IEnumerable<ITestSuite> suites = converter.ConvertToGTest(tests.ToArray(), logger);

            foreach (var suite in suites)
            {
                logger.Information(string.Format("Processing suite {0}...", suite.RunTarget));
                VSTracker tracker = new VSTracker(frameworkHandle, suite);
                GTestRunner runner = new GTestRunner(logger, false);

                runner.TestCompleted += tracker.TestCompleted;
                logger.Information(string.Format("Running suite {0}...", suite.RunTarget));
                runner.Run(suite);
            }
        }
Пример #2
0
        public void RunTests(IEnumerable<string> sources, IRunContext runContext, IFrameworkHandle frameworkHandle)
        {
            VSLogger logger = new VSLogger(frameworkHandle);

            foreach (var source in sources)
            {
                logger.Information(string.Format("Attempting to run tests in {0}", source));

                GTestExtractor extractor = new GTestExtractor(false);
                ITestSuite suite = extractor.ExtractFrom(source);

                VSTracker tracker = new VSTracker(frameworkHandle, suite);
                GTestRunner runner = new GTestRunner(logger, false);
                runner.TestCompleted += tracker.TestCompleted;

                runner.Run(suite);
            }
        }