Esempio n. 1
0
        public void TestFinished(ITestResult result)
        {
            var testAssembly = result.Test as TestAssembly;
            if (testAssembly != null)
            {
                this.WriteVerbose("=== Executed {0} tests in assembly {1} ===",
                    testAssembly.TestCaseCount,
                    testAssembly.Assembly.FullName);

                this.WriteInfo("\nPassed : {0}\tFailed : {1}",
                    result.PassCount, result.FailCount);
            }

            var testFixture = result.Test as TestFixture;
            if (testFixture != null)
            {
                if (result.FailCount > 0)
                {
                    this.WriteError("Test Fixture {0} ({1}) has {2} failures.",
                        testFixture.Name, testFixture.FullName, result.FailCount);

                    if (result.HasChildren)
                    {
                        foreach (var childResult in result.Children)
                        {
                            if (childResult.ResultState.Site != FailureSite.Test)
                                TestFinished(childResult);
                        }
                    }

                    this.WriteError("\tMessage : {0}", result.Message);
                    this.WriteError("\tStack trace : {0}", result.StackTrace);
                }
                this.WriteVerbose("  --- Executed tests in class {0}   ---\n", testFixture.FullName);
            }

            var testMethod = result.Test as TestMethod;
            if (testMethod != null)
            {
                if (result.FailCount > 0)
                {
                    this.WriteError("FAIL {0} ({1})", testMethod.MethodName, testMethod.FullName);
                    this.WriteError("\tMessage : {0}", result.Message);
                    this.WriteError("\tStack trace : {0}", result.StackTrace);
                }

                if (result.InconclusiveCount > 0)
                {
                    this.WriteInfo("INCONCLUSIVE {0}", testMethod.MethodName);
                }

                if (result.PassCount > 0)
                {
                    this.WriteInfo("PASS {0}", testMethod.MethodName);
                }

                TestCompleted(testMethod);
                var testSucceeded = result.HasTestSucceeded();
                TestCompleted(testMethod.Name, testSucceeded);
                if (!testSucceeded)
                    FailedTestMethods.Add(testMethod);
            }
        }
Esempio n. 2
0
        public void TestFinished(ITestResult result)
        {
            var testAssembly = result.Test as TestAssembly;

            if (testAssembly != null)
            {
                this.WriteVerbose("=== Executed {0} tests in assembly {1} ===",
                                  testAssembly.TestCaseCount,
                                  testAssembly.Assembly.FullName);

                this.WriteInfo("\nPassed : {0}\tFailed : {1}",
                               result.PassCount, result.FailCount);
            }

            var testFixture = result.Test as TestFixture;

            if (testFixture != null)
            {
                if (result.FailCount > 0)
                {
                    this.WriteError("Test Fixture {0} ({1}) has {2} failures.",
                                    testFixture.Name, testFixture.FullName, result.FailCount);

                    if (result.HasChildren)
                    {
                        foreach (var childResult in result.Children)
                        {
                            if (childResult.ResultState.Site != FailureSite.Test)
                            {
                                TestFinished(childResult);
                            }
                        }
                    }

                    this.WriteError("\tMessage : {0}", result.Message);
                    this.WriteError("\tStack trace : {0}", result.StackTrace);
                }
                this.WriteVerbose("  --- Executed tests in class {0}   ---\n", testFixture.FullName);
            }

            var testMethod = result.Test as TestMethod;

            if (testMethod != null)
            {
                if (result.FailCount > 0)
                {
                    this.WriteError("FAIL {0} ({1})", testMethod.MethodName, testMethod.FullName);
                    this.WriteError("\tMessage : {0}", result.Message);
                    this.WriteError("\tStack trace : {0}", result.StackTrace);
                }

                if (result.InconclusiveCount > 0)
                {
                    this.WriteInfo("INCONCLUSIVE {0}", testMethod.MethodName);
                }

                if (result.PassCount > 0)
                {
                    this.WriteInfo("PASS {0}", testMethod.MethodName);
                }

                TestCompleted(testMethod);
                var testSucceeded = result.HasTestSucceeded();
                TestCompleted(testMethod.Name, testSucceeded);
                if (!testSucceeded)
                {
                    FailedTestMethods.Add(testMethod);
                }
            }
        }