Exemplo n.º 1
0
        static void DisplayRunResult(RunSummary summary, int totalRuns)
        {
            var runDescriptor = summary.RunDescriptor;
            var runResult = summary.Result;

            Console.WriteLine("------------------------------------------------------");
            Console.WriteLine("Test summary for: {0}", runDescriptor.Key);
            if (totalRuns > 1)
            {
                Console.WriteLine(" - Permutation: {0}({1})", runDescriptor.Permutation, totalRuns);
            }
            Console.WriteLine();

            PrintSettings(runDescriptor.Settings);

            Console.WriteLine();
            Console.WriteLine("Endpoints:");

            foreach (var endpoint in runResult.ActiveEndpoints)
            {
                Console.WriteLine("     - {0}", endpoint);
            }

            if (runResult.Failed)
            {
                Console.WriteLine("Test failed: {0}", runResult.Exception);
            }
            else
            {
                Console.WriteLine("Result: Successful - Duration: {0}", runResult.TotalTime);
            }

            //dump trace and context regardless since asserts outside the should could still fail the test
            Console.WriteLine();
            Console.WriteLine("Context:");

            foreach (var prop in runResult.ScenarioContext.GetType().GetProperties())
            {
                if (prop.Name == "Trace")
                {
                    continue;
                }

                Console.WriteLine("{0} = {1}", prop.Name, prop.GetValue(runResult.ScenarioContext, null));
            }

            Console.WriteLine();
            Console.WriteLine("Trace:");
            Console.WriteLine(runResult.ScenarioContext.Trace);
            Console.WriteLine("------------------------------------------------------");
        }
Exemplo n.º 2
0
        static void DisplayRunResult(RunSummary summary, int totalRuns)
        {
            var runDescriptor = summary.RunDescriptor;
            var runResult = summary.Result;

            Console.Out.WriteLine("------------------------------------------------------");
            Console.Out.WriteLine("Test summary for: {0}", runDescriptor.Key);
            if (totalRuns > 1)
                Console.Out.WriteLine(" - Permutation: {0}({1})", runDescriptor.Permutation, totalRuns);
            Console.Out.WriteLine("");

            PrintSettings(runDescriptor.Settings);

            Console.WriteLine("");
            Console.WriteLine("Endpoints:");

            foreach (var endpoint in runResult.ActiveEndpoints)
            {
                Console.Out.WriteLine("     - {0}", endpoint);
            }

            if (runResult.Failed)
            {
                Console.Out.WriteLine("Test failed: {0}", runResult.Exception);

                Console.Out.WriteLine("Context:");

                foreach (var prop in runResult.ScenarioContext.GetType().GetProperties())
                {
                    Console.Out.WriteLine("{0} = {1}", prop.Name, prop.GetValue(runResult.ScenarioContext,null));
                }
            }
            else
            {
                Console.Out.WriteLine("Result: Successful - Duration: {0}", runResult.TotalTime);
                Console.Out.WriteLine("------------------------------------------------------");

            }
        }
Exemplo n.º 3
0
        internal async Task RaiseOnTestCompleted(RunSummary result)
        {
            await Task.WhenAll(onCompletedCallbacks.Select(c => c(result))).ConfigureAwait(false);

            onCompletedCallbacks = null;
        }