Пример #1
0
        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);
                }
            }
        }