public void CaseFailed(FailResult result)
        {
            if (isParameterized)
            {
                var newTask = new TestCaseTask(result.Case.Name, nodeRunner.CurrentTask.AssemblyLocation);
                server.CreateDynamicElement(newTask);
                nodeRunner.AddTask(newTask);
            }

            var task = nodeRunner.CurrentTask;

            if (!string.IsNullOrWhiteSpace(result.Output))
            {
                server.TaskOutput(task, result.Output, TaskOutputType.STDOUT);
            }
            if (result.Exceptions != null && result.Exceptions.Any())
            {
                server.TaskException(task, result.Exceptions.Select(ex => new TaskException(ex)).ToArray());
                task.CloseTask(TaskResult.Exception, result.Case.Name);
            }
            else
            {
                task.CloseTask(TaskResult.Error, result.Case.Name);
            }


            if (isParameterized)
            {
                nodeRunner.FinishCurrentTask(task);
            }
        }
Exemplo n.º 2
0
 public void CaseFailed(FailResult result)
 {
     Message("testStarted name='{0}'", result.Name);
     Output(result.Name, result.Output);
     Message("testFailed name='{0}' message='{1}' details='{2}'", result.Name, result.Exceptions.PrimaryException.Message, result.Exceptions.CompoundStackTrace);
     Message("testFinished name='{0}' duration='{1}'", result.Name, DurationInMilliseconds(result.Duration));
 }
Exemplo n.º 3
0
 public void CaseFailed(FailResult result)
 {
     using (Foreground.Red)
         Console.WriteLine("Test '{0}' failed: {1}", result.Name, result.Exceptions.PrimaryException.DisplayName);
     Console.WriteLine(result.Exceptions.CompoundStackTrace);
     Console.WriteLine();
 }
Exemplo n.º 4
0
        CaseResult Fail(Case @case)
        {
            var result = new FailResult(@case, assertionLibraryFilter);

            listener.CaseFailed(result);
            return(result);
        }
Exemplo n.º 5
0
        public void CaseFailed(FailResult result)
        {
            var entry = new StringBuilder();

            var primaryException = result.Exceptions.PrimaryException;

            entry.AppendFormat("{0} failed: {1}", result.Name, primaryException.Message);

            var walk = primaryException;

            while (walk.InnerException != null)
            {
                walk = walk.InnerException;
                entry.AppendLine();
                entry.AppendFormat("    Inner Exception: {0}", walk.Message);
            }

            foreach (var secondaryException in result.Exceptions.SecondaryExceptions)
            {
                entry.AppendLine();
                entry.AppendFormat("    Secondary Failure: {0}", secondaryException.Message);

                walk = secondaryException;
                while (walk.InnerException != null)
                {
                    walk = walk.InnerException;
                    entry.AppendLine();
                    entry.AppendFormat("        Inner Exception: {0}", walk.Message);
                }
            }

            log.Add(entry.ToString());
        }
Exemplo n.º 6
0
        public void CaseFailed(FailResult result)
        {
            var @case = result.Case;

            using (Foreground.Red)
                Console.WriteLine("Test '{0}' failed: {1}", @case.Name, result.ExceptionSummary.DisplayName);
            Console.WriteLine(result.ExceptionSummary.StackTrace);
            Console.WriteLine();
        }
Exemplo n.º 7
0
        public void CaseFailed(FailResult result)
        {
            var @case = result.Case;

            Message("testStarted name='{0}'", @case.Name);
            Output(@case, result.Output);
            Message("testFailed name='{0}' message='{1}' details='{2}'", @case.Name, result.ExceptionSummary.Message, result.ExceptionSummary.StackTrace);
            Message("testFinished name='{0}' duration='{1}'", @case.Name, DurationInMilliseconds(result.Duration));
        }
Exemplo n.º 8
0
        public void CaseFailed(FailResult result)
        {
            var @case = result.Case;

            Message("testStarted name='{0}'", @case.Name);
            Output(@case, result.Output);
            Message("testFailed name='{0}' message='{1}' details='{2}'", @case.Name, result.PrimaryExceptionMessage(), result.CompoundStackTrace());
            Message("testFinished name='{0}' duration='{1}'", @case.Name, DurationInMilliseconds(result.Duration));
        }
Exemplo n.º 9
0
        public void CaseFailed(FailResult result)
        {
            var @case = result.Case;

            using (Foreground.Red)
                Console.WriteLine("Test '{0}' failed: {1}", @case.Name, result.ExceptionSummary.DisplayName);
            Console.WriteLine(result.ExceptionSummary.StackTrace);
            Console.WriteLine();
        }
Exemplo n.º 10
0
 public void CaseFailed(FailResult result)
 {
     tdnet.TestFinished(new TestResult
     {
         Name       = result.Name,
         State      = TestState.Failed,
         Message    = result.Exceptions.PrimaryException.DisplayName,
         StackTrace = result.Exceptions.CompoundStackTrace,
     });
 }
Exemplo n.º 11
0
        public void CaseFailed(FailResult result)
        {
            var @case = result.Case;

            using (Foreground.Red)
                Console.WriteLine("Test '{0}' failed: {1}", @case.Name, result.PrimaryExceptionTypeName());
            result.WriteCompoundStackTraceTo(Console.Out);
            Console.WriteLine();
            Console.WriteLine();
        }
Exemplo n.º 12
0
        public void CaseFailed(FailResult result)
        {
            var @case = result.Case;

            using (Foreground.Red)
                Console.WriteLine("Test '{0}' failed: {1}", @case.Name, result.PrimaryExceptionTypeName());
            result.WriteCompoundStackTraceTo(Console.Out);
            Console.WriteLine();
            Console.WriteLine();
        }
Exemplo n.º 13
0
        public void CaseFailed(FailResult result)
        {
            var @case = result.Case;

            tdnet.TestFinished(new TestResult
            {
                Name = @case.Name,
                State = TestState.Failed,
                Message = result.ExceptionSummary.DisplayName,
                StackTrace = result.ExceptionSummary.StackTrace,
            });
        }
Exemplo n.º 14
0
        public void CaseFailed(FailResult result)
        {
            var @case = result.Case;

            tdnet.TestFinished(new TestResult
            {
                Name       = @case.Name,
                State      = TestState.Failed,
                Message    = result.ExceptionSummary.DisplayName,
                StackTrace = result.ExceptionSummary.StackTrace,
            });
        }
Exemplo n.º 15
0
        public void CaseFailed(FailResult result)
        {
            var @case = result.Case;

            tdnet.TestFinished(new TestResult
            {
                Name       = @case.Name,
                State      = TestState.Failed,
                Message    = result.PrimaryExceptionTypeName(),
                StackTrace = result.CompoundStackTrace(),
            });
        }
Exemplo n.º 16
0
        public void CaseFailed(FailResult result)
        {
            var @case = result.Case;

            tdnet.TestFinished(new TestResult
            {
                Name = @case.Name,
                State = TestState.Failed,
                Message = result.PrimaryExceptionTypeName(),
                StackTrace = result.CompoundStackTrace(),
            });
        }
Exemplo n.º 17
0
        public ConventionResult Run(Convention convention, Listener listener, params Type[] candidateTypes)
        {
            var executionPlan = new ExecutionPlan(convention);
            var conventionResult = new ConventionResult(convention.GetType().FullName);

            foreach (var testClass in convention.Classes.Filter(candidateTypes))
            {
                var classResult = new ClassResult(testClass.FullName);

                var methods = convention.Methods.Filter(testClass);

                var cases = methods.SelectMany(method => CasesForMethod(convention, method)).ToArray();
                var casesBySkipState = cases.ToLookup(convention.CaseExecution.SkipPredicate);
                var casesToSkip = casesBySkipState[true];
                var casesToExecute = casesBySkipState[false];
                foreach (var @case in casesToSkip)
                {
                    var skipResult = new SkipResult(@case, convention.CaseExecution.SkipReasonProvider(@case));
                    listener.CaseSkipped(skipResult);
                    classResult.Add(CaseResult.Skipped(skipResult.Case.Name, skipResult.Reason));
                }

                var caseExecutions = casesToExecute.Select(@case => new CaseExecution(@case)).ToArray();
                if (caseExecutions.Any())
                {
                    convention.ClassExecution.OrderCases(caseExecutions);

                    var classExecution = new ClassExecution(executionPlan, testClass, caseExecutions);
                    executionPlan.Execute(classExecution);

                    foreach (var caseExecution in caseExecutions)
                    {
                        if (caseExecution.Exceptions.Any())
                        {
                            var failResult = new FailResult(caseExecution, convention.HideExceptionDetails);
                            listener.CaseFailed(failResult);
                            classResult.Add(CaseResult.Failed(failResult.Case.Name, failResult.Duration, failResult.ExceptionSummary));
                        }
                        else
                        {
                            var passResult = new PassResult(caseExecution);
                            listener.CasePassed(passResult);
                            classResult.Add(CaseResult.Passed(passResult.Case.Name, passResult.Duration));
                        }
                    }

                }

                conventionResult.Add(classResult);
            }

            return conventionResult;
        }
Exemplo n.º 18
0
        public void CaseFailed(FailResult result)
        {
            var testCase = new TestCase(result.Case.Name, new Uri(Constants.EXECUTOR_URI_STRING), source);

            frameworkHandle.RecordStart(testCase);
            var testResult = new TestResult(testCase)
            {
                Outcome         = TestOutcome.Failed,
                ErrorMessage    = result.Exceptions.First().GetType().FullName,
                ErrorStackTrace = CompoundStackTrace(result.Exceptions)
            };

            frameworkHandle.RecordEnd(testCase, TestOutcome.Failed);
            frameworkHandle.RecordResult(testResult);
        }
Exemplo n.º 19
0
        public ConventionResult Execute(Listener listener, params Type[] candidateTypes)
        {
            var conventionResult = new ConventionResult(GetType().FullName);

            foreach (var testClass in Classes.Filter(candidateTypes))
            {
                var classResult = new ClassResult(testClass.FullName);

                var methods = Methods.Filter(testClass);

                var cases            = methods.SelectMany(method => CasesForMethod(testClass, method)).ToArray();
                var casesBySkipState = cases.ToLookup(CaseExecution.SkipPredicate);
                var casesToSkip      = casesBySkipState[true];
                var casesToExecute   = casesBySkipState[false];
                foreach (var @case in casesToSkip)
                {
                    var skipResult = new SkipResult(@case, CaseExecution.SkipReasonProvider(@case));
                    listener.CaseSkipped(skipResult);
                    classResult.Add(CaseResult.Skipped(skipResult.Case.Name, skipResult.Reason));
                }

                var caseExecutions = casesToExecute.Select(@case => new CaseExecution(@case)).ToArray();
                if (caseExecutions.Any())
                {
                    ClassExecution.Behavior.Execute(testClass, this, caseExecutions);

                    foreach (var caseExecution in caseExecutions)
                    {
                        if (caseExecution.Exceptions.Any())
                        {
                            var failResult = new FailResult(caseExecution, AssertionLibrary);
                            listener.CaseFailed(failResult);
                            classResult.Add(CaseResult.Failed(failResult.Case.Name, failResult.Duration, failResult.ExceptionSummary));
                        }
                        else
                        {
                            var passResult = new PassResult(caseExecution);
                            listener.CasePassed(passResult);
                            classResult.Add(CaseResult.Passed(passResult.Case.Name, passResult.Duration));
                        }
                    }
                }

                conventionResult.Add(classResult);
            }

            return(conventionResult);
        }
Exemplo n.º 20
0
        public void CaseFailed(FailResult result)
        {
            var @case = result.Case;

            var entry = new StringBuilder();

            entry.Append(string.Format("{0} failed: {1}", @case.Name, result.ExceptionSummary.Message));

            foreach (var exception in result.Exceptions.Skip(1))
            {
                entry.AppendLine();
                entry.Append(string.Format("    Secondary Failure: {0}", exception.Message));
            }

            log.Add(entry.ToString());
        }
Exemplo n.º 21
0
        public void CaseFailed(FailResult result)
        {
            var @case = result.Case;

            var entry = new StringBuilder();

            entry.Append(string.Format("{0} failed: {1}", @case.Name, result.ExceptionSummary.Message));

            foreach (var exception in result.Exceptions.Skip(1))
            {
                entry.AppendLine();
                entry.Append(string.Format("    Secondary Failure: {0}", exception.Message));
            }

            log.Add(entry.ToString());
        }
Exemplo n.º 22
0
        public void CaseFailed(FailResult result)
        {
            var caseResult = (CaseResult)result;

            Post(new TestResult
            {
                testFramework        = "Fixie",
                fileName             = fileName,
                testName             = caseResult.Name,
                outcome              = "Failed",
                durationMilliseconds = caseResult.Duration.TotalMilliseconds.ToString("0"),
                StdOut          = caseResult.Output,
                ErrorMessage    = caseResult.Exceptions.PrimaryException.DisplayName,
                ErrorStackTrace = caseResult.Exceptions.CompoundStackTrace
            });
        }
Exemplo n.º 23
0
        public void CaseFailed(FailResult result)
        {
            var testResult = new TestResult(TestCase(result.MethodGroup))
            {
                DisplayName     = result.Name,
                Outcome         = Map(CaseStatus.Failed),
                Duration        = result.Duration,
                ComputerName    = Environment.MachineName,
                ErrorMessage    = result.Exceptions.PrimaryException.DisplayName,
                ErrorStackTrace = result.Exceptions.CompoundStackTrace
            };

            AttachCapturedConsoleOutput(result.Output, testResult);

            log.RecordResult(testResult);
        }
Exemplo n.º 24
0
 public void CaseFailed(FailResult result) => Log.Add(result);
Exemplo n.º 25
0
        public ConventionResult Execute(Listener listener, params Type[] candidateTypes)
        {
            var conventionResult = new ConventionResult(GetType().FullName);

            foreach (var testClass in Classes.Filter(candidateTypes))
            {
                var classResult = new ClassResult(testClass.FullName);

                var methods = Methods.Filter(testClass);

                var cases = methods.SelectMany(method => CasesForMethod(testClass, method)).ToArray();
                var casesBySkipState = cases.ToLookup(CaseExecution.SkipPredicate);
                var casesToSkip = casesBySkipState[true];
                var casesToExecute = casesBySkipState[false];
                foreach (var @case in casesToSkip)
                {
                    listener.CaseSkipped(@case);
                    classResult.Add(CaseResult.Skipped(@case.Name, CaseExecution.SkipReasonProvider(@case)));
                }

                var caseExecutions = casesToExecute.Select(@case => new CaseExecution(@case)).ToArray();
                if (caseExecutions.Any())
                {
                    ClassExecution.Behavior.Execute(testClass, this, caseExecutions);

                    foreach (var caseExecution in caseExecutions)
                    {
                        if (caseExecution.Exceptions.Any())
                        {
                            var failResult = new FailResult(caseExecution);
                            listener.CaseFailed(failResult);
                            classResult.Add(CaseResult.Failed(failResult.Case.Name, failResult.Duration, failResult.PrimaryExceptionMessage(), failResult.CompoundStackTrace(), failResult.PrimaryExceptionTypeName()));
                        }
                        else
                        {
                            var passResult = new PassResult(caseExecution);
                            listener.CasePassed(passResult);
                            classResult.Add(CaseResult.Passed(passResult.Case.Name, passResult.Duration));
                        }
                    }

                }

                conventionResult.Add(classResult);
            }

            return conventionResult;
        }
Exemplo n.º 26
0
 public void CaseFailed(FailResult result)
 {
 }