private static void InteractiveMode(TestRunResult result) { var currentFailure = 0; var lastKey = Console.ReadKey().Key; while (lastKey != ConsoleKey.Escape && currentFailure < result.FailureMessages.Count) { Console.WriteLine("Failure #{0} of {1}", currentFailure + 1, result.FailureMessages.Count); Console.WriteLine(result.FailureMessages[currentFailure]); Console.WriteLine(); var key = Console.ReadKey(); if (key.Key == ConsoleKey.UpArrow && currentFailure > 0) { Console.Clear(); currentFailure--; } else { if (key.Key == ConsoleKey.DownArrow) { Console.Clear(); currentFailure++; } } } Console.ForegroundColor = ConsoleColor.Gray; Console.ReadKey(); }
public TestRunResult Execute() { this.InitializeQuietMode(); Directory.CreateDirectory(this.path); Directory.SetCurrentDirectory(this.path); this.CopyDeploymentFiles(); var result = new TestRunResult(this.QuietMode); result.Start(); Parallel.ForEach( this.testList, new ParallelOptions { MaxDegreeOfParallelism = this.Parallelism }, async testItem => { try { var successCount = await testItem.Execute(testItem, result).ConfigureAwait(false); result.Success(testItem, successCount); } catch (Exception ex) { result.Failure(testItem, string.Empty, ex); } }); result.Stop(); this.StopQuietMode(); return(result); }
private static void ListFailures(TestRunResult result) { for (int i = 0; i < result.FailureMessages.Count; i++) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Failure #{0} of {1}", i + 1, result.FailureMessages.Count); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine(result.FailureMessages[i]); Console.WriteLine(); } }
public static void Generate(string path, TestRunResult result) { var outcome = result.Failed == 0 ? (result.Ignored == 0 ? "Completed" : "Warning") : "Failed"; var ns = XNamespace.Get("http://microsoft.com/schemas/VisualStudio/TeamTest/2010"); var testListId = Guid.NewGuid(); var doc = new XDocument(new XElement(ns + "TestRun", new XAttribute("id", Guid.NewGuid()), new XElement(ns + "TestSettings"), new XElement(ns + "Times"), new XElement(ns + "ResultSummary", new XAttribute("outcome", outcome), new XElement(ns + "Counters", new XAttribute("total", result.Succeeded + result.Failed + result.Ignored), new XAttribute("executed", result.Succeeded + result.Failed), new XAttribute("error", 0), new XAttribute("failed", result.Failed), new XAttribute("timeout", 0), new XAttribute("aborted", 0), new XAttribute("inconclusive", 0), new XAttribute("passedButRunAborted", 0), new XAttribute("notRunnable", 0), new XAttribute("notExecuted", 0), new XAttribute("disconnected", 0), new XAttribute("warning", 0), new XAttribute("completed", 0), new XAttribute("inProgress", 0), new XAttribute("pending", 0) ), new XElement(ns + "RunInfos")), new XElement(ns + "TestDefinitions", result.Tests.Select(TestDefinition)), new XElement(ns + "TestLists", new XElement(ns + "TestList", new XAttribute("name", "List"), new XAttribute("id", testListId))), new XElement(ns + "TestEntries", result.Tests.Select(test => TestEntry(test, testListId))), new XElement(ns + "Results", result.Tests.Select(test => TestResult(test, testListId))) )); doc.Save(path); }