Exemple #1
0
        private void Visit(NUnit.Framework.Api.ITestResult result)
        {
            if (result.Test is TestSuite)
            {
                foreach (NUnit.Framework.Api.ITestResult child in result.Children)
                {
                    Visit(child);
                }
                return;
            }
            testCount++;
            switch (result.ResultState.Status)
            {
            case TestStatus.Skipped:
                notRunCount++;
                break;

            case TestStatus.Failed:
                if (result.ResultState == ResultState.Failure)
                {
                    failureCount++;
                }
                else
                {
                    errorCount++;
                }
                break;

            case TestStatus.Passed:
                break;
            }
        }
Exemple #2
0
        private void PrintAllResults(NUnit.Framework.Api.ITestResult result, string indent)
        {
            string value = null;

            switch (result.ResultState.Status)
            {
            case TestStatus.Failed:
                value = "FAIL";
                break;

            case TestStatus.Skipped:
                value = "SKIP";
                break;

            case TestStatus.Inconclusive:
                value = "INC ";
                break;

            case TestStatus.Passed:
                value = "OK  ";
                break;
            }
            writer.Write(value);
            writer.Write(indent);
            writer.WriteLine(result.Name);
            if (!result.HasChildren)
            {
                return;
            }
            foreach (NUnit.Framework.Api.ITestResult child in result.Children)
            {
                PrintAllResults(child, indent + "  ");
            }
        }
Exemple #3
0
 private void PrintErrorReport(NUnit.Framework.Api.ITestResult result)
 {
     reportCount = 0;
     writer.WriteLine();
     writer.WriteLine("Errors and Failures:");
     PrintErrorResults(result);
 }
Exemple #4
0
 private void PrintNotRunReport(NUnit.Framework.Api.ITestResult result)
 {
     reportCount = 0;
     writer.WriteLine();
     writer.WriteLine("Tests Not Run:");
     PrintNotRunResults(result);
 }
 private void ReportResults(NUnit.Framework.Api.ITestResult result)
 {
     Summary = new ResultSummary(result);
     writer.WriteLine("{0} Tests : {1} Failures, {2} Errors, {3} Not Run", Summary.TestCount, Summary.FailureCount, Summary.ErrorCount, Summary.NotRunCount);
     if (Summary.FailureCount > 0 || Summary.ErrorCount > 0)
     {
         PrintErrorReport(result);
     }
     if (Summary.NotRunCount > 0)
     {
         PrintNotRunReport(result);
     }
 }
Exemple #6
0
        private void RunTests()
        {
            NUnit.Framework.Api.ITestResult testResult = runner.Run(TestListener.NULL, TestFilter.Empty);
            ReportResults(testResult);
            string resultFile = commandLineOptions.ResultFile;

            if (resultFile != null)
            {
                XmlTextWriter xmlTextWriter = new XmlTextWriter(resultFile, Encoding.UTF8);
                xmlTextWriter.Formatting = Formatting.Indented;
                testResult.ToXml(recursive: true).WriteTo(xmlTextWriter);
                xmlTextWriter.Close();
            }
        }
Exemple #7
0
        public void AddResult(NUnit.Framework.Api.ITestResult result)
        {
            if (children == null)
            {
                children = new List <NUnit.Framework.Api.ITestResult>();
            }
            children.Add(result);
            TestStatus status = result.ResultState.Status;

            if (status == TestStatus.Failed)
            {
                SetResult(ResultState.Failure, "Component test failure");
            }
        }
Exemple #8
0
 private void PrintNotRunResults(NUnit.Framework.Api.ITestResult result)
 {
     if (result.HasChildren)
     {
         foreach (NUnit.Framework.Api.ITestResult child in result.Children)
         {
             PrintNotRunResults(child);
         }
     }
     else if (result.ResultState == ResultState.Ignored || result.ResultState == ResultState.NotRunnable || result.ResultState == ResultState.Skipped)
     {
         writer.WriteLine();
         writer.WriteLine("{0}) {1} ({2}) : {3}", ++reportCount, result.Name, result.FullName, result.Message);
     }
 }
Exemple #9
0
 private void PrintErrorResults(NUnit.Framework.Api.ITestResult result)
 {
     if (result.HasChildren)
     {
         foreach (NUnit.Framework.Api.ITestResult child in result.Children)
         {
             PrintErrorResults(child);
         }
     }
     else if (result.ResultState == ResultState.Error || result.ResultState == ResultState.Failure)
     {
         writer.WriteLine();
         writer.WriteLine("{0}) {1} ({2})", ++reportCount, result.Name, result.FullName);
         writer.WriteLine(result.Message);
         writer.WriteLine(result.StackTrace);
     }
 }
Exemple #10
0
        private void ReportResults(NUnit.Framework.Api.ITestResult result)
        {
            ResultSummary resultSummary = new ResultSummary(result);

            writer.WriteLine("{0} Tests : {1} Failures, {2} Errors, {3} Not Run", resultSummary.TestCount, resultSummary.FailureCount, resultSummary.ErrorCount, resultSummary.NotRunCount);
            if (resultSummary.FailureCount > 0 || resultSummary.ErrorCount > 0)
            {
                PrintErrorReport(result);
            }
            if (resultSummary.NotRunCount > 0)
            {
                PrintNotRunReport(result);
            }
            if (commandLineOptions.Full)
            {
                PrintFullReport(result);
            }
        }
Exemple #11
0
 public ResultSummary(NUnit.Framework.Api.ITestResult result)
 {
     Visit(result);
 }
Exemple #12
0
 private void PrintFullReport(NUnit.Framework.Api.ITestResult result)
 {
     writer.WriteLine();
     writer.WriteLine("All Test Results:");
     PrintAllResults(result, " ");
 }
 public void TestFinished(NUnit.Framework.Api.ITestResult result)
 {
 }
 private void RunTests()
 {
     NUnit.Framework.Api.ITestResult result = runner.Run(TestListener.NULL, TestFilter.Empty);
     ReportResults(result);
 }