Пример #1
0
        void IRunnerLogger.TestSkipped(string name, string type, string method, string reason)
        {
            Trace.TraceInformation("UnitTestRunner.TestSkipped was called.");

            var errorInfo = new TestResultErrorInfo(reason);

            var result = TestComplete(name, TestOutcome.Completed, 0, null, errorInfo);
            //result.AddTextMessage(reason);
        }
Пример #2
0
        private MSVST4U_UnitTestResult TestComplete(string name, TestOutcome outcome, double duration, string output, TestResultErrorInfo errorInfo)
        {
            MSVST4U_UnitTestResult result;
            int dataIndex = name.IndexOf('(') + 1;

            if (dataIndex > 0)
            {
                _isTheory = true;
                string data = name.Substring(dataIndex, name.Length - dataIndex - 1);
                var id = new TestResultId(_runId, new TestExecId(), _test.ExecutionId, _test.Id);
                result = MSVST4U_Access.New_MSVST4U_UnitTestResult_DataDrivenRow(id, _test, data);
            }
            else
            {
                result = MSVST4U_Access.New_MSVST4U_UnitTestResult_Standard(_runId, _test);
            }

            _results.Add(result);

            result.EndTime = DateTime.Now;
            result.Duration = TimeSpan.FromSeconds(duration);
            result.StartTime = result.EndTime - result.Duration;

            result.Outcome = outcome;
            result.StdOut = output ?? "";

            result.ErrorInfo = errorInfo;

            return result;
        }
Пример #3
0
        void IRunnerLogger.TestFailed(string name, string type, string method, double duration, string output, string exceptionType, string message, string stackTrace)
        {
            Trace.TraceInformation("UnitTestRunner.TestFailed was called.");

            if (message == null || !message.Contains(exceptionType))
                message = exceptionType + ": " + message;

            var errorInfo = new TestResultErrorInfo(message) { StackTrace = stackTrace };

            TestComplete(name, TestOutcome.Failed, duration, output, errorInfo);
        }