public int Exec(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) { ThreadHelper.ThrowIfNotOnUIThread(); if (VsShellUtilities.IsInAutomationFunction(_serviceProvider)) { return(Next.Exec(ref pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut)); } if ((VSConstants.VSStd2KCmdID)nCmdID != VSConstants.VSStd2KCmdID.FORMATDOCUMENT) { return(Next.Exec(pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut)); } var gaugeFile = new FileInfo(GaugePackage.DTE.ActiveDocument.FullName); var p = GaugeProcess.ForFormat(gaugeFile.DirectoryName, gaugeFile.Name); p.Start(); p.WaitForExit(); if (p.ExitCode != 0) { OutputPaneLogger.Error($"gauge format {gaugeFile.Name}\nSTDOUT:\n{p.StandardOutput.ReadToEnd()}\nSTDERR:\n{p.StandardError.ReadToEnd()}\n"); } return(VSConstants.S_OK); }
public GaugeRunner(IEnumerable <TestCase> tests, bool isBeingDebugged, bool isParallelRun, IFrameworkHandle frameworkHandle) { _tests = tests.GroupBy(t => t.Source) .SelectMany(spec => spec.OrderBy(t => t.LineNumber)) .ToList(); _pendingTests = new List <TestCase>(_tests); _isBeingDebugged = isBeingDebugged; _frameworkHandle = frameworkHandle; var projectRoot = _tests.First().GetPropertyValue(TestDiscoverer.GaugeProjectRoot, string.Empty); var gaugeCustomBuildPath = _tests.First().GetPropertyValue(TestDiscoverer.GaugeCustomBuildPath, string.Empty); var scenarios = new List <string>(); foreach (var testCase in _tests) { _frameworkHandle.RecordStart(testCase); _frameworkHandle.SendMessage(TestMessageLevel.Informational, $"Executing Test: {testCase}"); scenarios.Add($"\"{testCase.Source}:{testCase.LineNumber}\""); } _gaugeProcess = GaugeProcess.ForExecution(projectRoot, scenarios, gaugeCustomBuildPath, _isBeingDebugged, isParallelRun); _gaugeProcess.OutputDataReceived += OnOutputDataReceived; }