public void AddSuite(string filePath) { GTestExtractor extractor = new GTestExtractor(); ITestSuite suite = extractor.ExtractFrom(filePath); Suites.RemoveAll(s => suite.RunTarget == s.RunTarget); Suites.Add(suite); OnPropertyChanged(SuitesProperty); }
public void DiscoverTests(IEnumerable<string> sources, IDiscoveryContext discoveryContext, IMessageLogger messageLogger, ITestCaseDiscoverySink discoverySink) { var settingsProvider = discoveryContext.RunSettings.GetSettings(VSTestSettings.SettingsName) as VSTestSettingsService; var settings = settingsProvider != null && settingsProvider.Settings != null ? settingsProvider.Settings : new VSTestSettings() {WorkingDirectory = @"C:\Source"}; VSLogger logger = new VSLogger(messageLogger); foreach (var source in sources) { logger.Information(string.Format("Beginning test discovery on {0}", source)); GTestExtractor extractor = new GTestExtractor(false); ITestSuite suite = extractor.ExtractFrom(source); foreach (var testCase in suite.TestCases) { foreach (var test in testCase.Tests) { logger.Information(string.Format("Found test {0}", test.FullyQualifiedName)); discoverySink.SendTestCase(test.ToVSTest()); System.Threading.Thread.Sleep(0); } } //ProcessStartInfo listTestsInfo = new ProcessStartInfo(); //listTestsInfo.FileName = source; //listTestsInfo.Arguments = "--gtest_list_tests"; //listTestsInfo.UseShellExecute = false; //listTestsInfo.CreateNoWindow = true; //listTestsInfo.RedirectStandardOutput = true; //Process listTestsProc = new Process(); //listTestsProc.StartInfo = listTestsInfo; //logger.SendMessage(TestMessageLevel.Informational, string.Format("Beginning test discovery on {0}", source)); //listTestsProc.Start(); //listTestsProc.WaitForExit(5000); //ParseTests(listTestsProc.StandardOutput, discoverySink, logger, source); } }
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); } }