public void Load(XmlReader reader)
 {
     if (reader != null)
     {
         if (reader.Read() && reader.Name.Equals(VSTestSettings.SettingsName))
         {
             Settings = serializer.Deserialize(reader) as VSTestSettings;
         }
     }
 }
예제 #2
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);
            }
        }