public void TestFinished(FacadeTestResult result)
        {
            if (result == null)
                throw new ArgumentNullException("result");

            try
            {
                testListener.TestFinished(FacadeUtils.ToTestResult(result));
            }
            catch (Exception ex)
            {
                throw ServerExceptionUtils.Wrap(ex);
            }
        }
Exemplo n.º 2
0
        public static TestResult ToTestResult(FacadeTestResult result)
        {
            if (result == null)
                return null;

            return new TestResult
            {
                State = ToTestState(result.State),
                Message = result.Message,
                Name = result.Name,
                StackTrace = result.StackTrace,
                TimeSpan = result.TimeSpan,
                TotalTests = result.TotalTests
            };
        }
Exemplo n.º 3
0
        public void TestFinished(FacadeTestResult result)
        {
            if (result == null)
            {
                throw new ArgumentNullException("result");
            }

            try
            {
                testListener.TestFinished(FacadeUtils.ToTestResult(result));
            }
            catch (Exception ex)
            {
                throw ServerExceptionUtils.Wrap(ex);
            }
        }
Exemplo n.º 4
0
        public static TestResult ToTestResult(FacadeTestResult result)
        {
            if (result == null)
            {
                return(null);
            }

            return(new TestResult
            {
                State = ToTestState(result.State),
                Message = result.Message,
                Name = result.Name,
                StackTrace = result.StackTrace,
                TimeSpan = result.TimeSpan,
                TotalTests = result.TotalTests
            });
        }
Exemplo n.º 5
0
        private void LogTest(TestStepFinishedEventArgs e)
        {
            // A TestResult with State == TestState.Passed won't be displayed in the
            // output window (TD.NET just diplays "[TestName] passed" in the status bar.
            // Since that can be harder to notice, and also is lost when the following
            // test finishes, we print a message in the output window so the user can 
            // progressively see if the tests are passing or failing.
            if (e.TestStepRun.Result.Outcome.Status == TestStatus.Passed)
            {
                testListener.WriteLine(String.Format(Resources.TDNetLogMonitor_TestCasePassed,
                    e.TestStepRun.Step.FullName), FacadeCategory.Info);
            }

            // Inform TD.NET what happened 
            FacadeTestResult result = new FacadeTestResult();
            result.Name = e.TestStepRun.Step.FullName;
            result.TimeSpan = e.TestStepRun.Result.Duration;
            // result.TestRunner = "Gallio"; // note: can crash in older versions of TD.Net with MissingFieldException

            // It's important to set the stack trace here so the user can double-click in the
            // output window to go the faulting line
            StructuredStream failureStream = e.TestStepRun.TestLog.GetStream(MarkupStreamNames.Failures);
            if (failureStream != null)
                result.StackTrace = failureStream.ToString();

            StructuredStream warningStream = e.TestStepRun.TestLog.GetStream(MarkupStreamNames.Warnings);
            if (warningStream != null)
                result.Message = warningStream.ToString();

            // TD.NET will automatically count the number of passed, ignored and failed tests
            // provided we call the TestFinished method with the right State
            result.State = GetTestState(e.TestStepRun.Result.Outcome.Status);

            testListener.TestFinished(result);
        }