Ejemplo n.º 1
0
        private void WriteSummaryReport()
        {
            ColorStyle overall = testRunResult == "Passed"
                ? ColorStyle.Pass
                : (testRunResult == "Failed" ? ColorStyle.Failure : ColorStyle.Warning);

            Console.WriteLine();
            ColorConsole.WriteLine(ColorStyle.SectionHeader, "Test Run Summary");
            ColorConsole.WriteLabel("    Overall result: ", testRunResult, overall, true);

            ColorConsole.WriteLabel("   Tests run: ", summary.TestsRun.ToString(CultureInfo.CurrentUICulture), false);
            ColorConsole.WriteLabel(", Errors: ", summary.Errors.ToString(CultureInfo.CurrentUICulture), false);
            ColorConsole.WriteLabel(", Failures: ", summary.Failures.ToString(CultureInfo.CurrentUICulture), false);
            ColorConsole.WriteLabel(", Inconclusive: ", summary.Inconclusive.ToString(CultureInfo.CurrentUICulture), true);

            ColorConsole.WriteLabel("     Not run: ", summary.TestsNotRun.ToString(CultureInfo.CurrentUICulture), false);
            ColorConsole.WriteLabel(", Invalid: ", summary.NotRunnable.ToString(CultureInfo.CurrentUICulture), false);
            ColorConsole.WriteLabel(", Ignored: ", summary.Ignored.ToString(CultureInfo.CurrentUICulture), false);
            ColorConsole.WriteLabel(", Skipped: ", summary.Skipped.ToString(CultureInfo.CurrentUICulture), true);

            ColorConsole.WriteLabel("  Start time: ", summary.StartTime.ToString("u"), true);
            ColorConsole.WriteLabel("    End time: ", summary.EndTime.ToString("u"), true);
            ColorConsole.WriteLabel("    Duration: ", string.Format("{0} seconds", summary.Duration.ToString("0.000")), true);
            Console.WriteLine();
        }
Ejemplo n.º 2
0
        private static void WriteHeader()
        {
            Assembly executingAssembly = Assembly.GetExecutingAssembly();
            string   versionText       = executingAssembly.GetName().Version.ToString(3);

            string programName   = "NUnit Console Runner";
            string copyrightText = "Copyright (C) 2011 Charlie Poole.\r\nAll Rights Reserved.";
            string configText    = "";

            object[] attrs = executingAssembly.GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
            if (attrs.Length > 0)
            {
                programName = ((AssemblyTitleAttribute)attrs[0]).Title;
            }

            attrs = executingAssembly.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
            if (attrs.Length > 0)
            {
                copyrightText = ((AssemblyCopyrightAttribute)attrs[0]).Copyright;
            }

            attrs = executingAssembly.GetCustomAttributes(typeof(AssemblyConfigurationAttribute), false);
            if (attrs.Length > 0)
            {
                configText = string.Format("({0})", ((AssemblyConfigurationAttribute)attrs[0]).Configuration);
            }

            ColorConsole.WriteLine(ColorStyle.Header, string.Format("{0} {1} {2}", programName, versionText, configText));
            ColorConsole.WriteLine(ColorStyle.SubHeader, copyrightText);
            Console.WriteLine();
            ColorConsole.WriteLine(ColorStyle.SectionHeader, "Runtime Environment - ");
            ColorConsole.WriteLabel("   OS Version: ", Environment.OSVersion.ToString(), true);
            ColorConsole.WriteLabel("  CLR Version: ", Environment.Version.ToString(), true);
            Console.WriteLine();
        }
Ejemplo n.º 3
0
        private void DisplayRequestedOptions()
        {
            ColorConsole.WriteLine(ColorStyle.SectionHeader, "Options -");
            ColorConsole.WriteLabel("    ProcessModel: ", options.ProcessModel ?? "Default", false);
            ColorConsole.WriteLabel("    DomainUsage: ", options.DomainUsage ?? "Default", true);
            ColorConsole.WriteLabel("    Execution Runtime: ", options.Framework ?? "Not Specified", true);
            if (options.DefaultTimeout >= 0)
            {
                ColorConsole.WriteLabel("    Default timeout: ", options.DefaultTimeout.ToString(), true);
            }
            if (options.NumWorkers > 0)
            {
                ColorConsole.WriteLabel("    Worker Threads: ", options.NumWorkers.ToString(), true);
            }
            ColorConsole.WriteLabel("    Work Directory: ", workDirectory, true);
            ColorConsole.WriteLabel("    Internal Trace: ", options.InternalTraceLevel ?? "Off", true);
            //if (options.DisplayTeamCityServiceMessages)
            //    Console.WriteLine("    Display TeamCity Service Messages");
            Console.WriteLine();

            if (options.TestList.Count > 0)
            {
                ColorConsole.WriteLine(ColorStyle.Label, "Selected test(s):");
                using (new ColorConsole(ColorStyle.Default))
                    foreach (string testName in options.TestList)
                    {
                        Console.WriteLine("    " + testName);
                    }
            }

            if (!string.IsNullOrEmpty(options.Include))
            {
                ColorConsole.WriteLabel("Included categories: ", options.Include, true);
            }

            if (!string.IsNullOrEmpty(options.Exclude))
            {
                ColorConsole.WriteLabel("Excluded categories: ", options.Exclude, true);
            }
        }