public void Run() { try { _frameworkHandle.SendMessage(TestMessageLevel.Informational, $"Invoking : {_gaugeProcess}"); _gaugeProcess.Start(); _gaugeProcess.BeginOutputReadLine(); if (_isBeingDebugged) { DTEHelper.AttachToProcess(_gaugeProcess.Id); _frameworkHandle.SendMessage(TestMessageLevel.Informational, $"Attaching to ProcessID {_gaugeProcess.Id}"); } _gaugeProcess.WaitForExit(); } catch (Exception ex) { _frameworkHandle.SendMessage(TestMessageLevel.Error, ex.Message); foreach (var testCase in _tests) { var result = new TestResult(testCase) { Outcome = TestOutcome.None, ErrorMessage = $"{ex.Message}\n{ex.StackTrace}" }; _frameworkHandle.RecordResult(result); _frameworkHandle.RecordEnd(testCase, result.Outcome); _pendingTests.Remove(testCase); } } }
public static GaugeVersionInfo GetInstalledGaugeVersion(IGaugeProcess gaugeProcess = null) { if (gaugeProcess == null) { gaugeProcess = GaugeProcess.ForVersion(); } gaugeProcess.Start(); var error = gaugeProcess.StandardError.ReadToEnd(); gaugeProcess.WaitForExit(); if (gaugeProcess.ExitCode != 0) { throw new GaugeVersionNotFoundException(error); } var serializer = new DataContractJsonSerializer(typeof(GaugeVersionInfo)); var versionText = SanitizeDeprecationMessage(gaugeProcess.StandardOutput.ReadToEnd()); using (var ms = new MemoryStream(Encoding.Unicode.GetBytes(versionText))) { return((GaugeVersionInfo)serializer.ReadObject(ms)); } }