private static async Task <int> RunCore(Options options, CancellationToken cancellationToken) { var testExecutor = CreateTestExecutor(options); var testRunner = new TestRunner(options, testExecutor); var start = DateTime.Now; Console.WriteLine($"Data Storage: {testExecutor.DataStorage.Name}"); Console.WriteLine($"Running {options.Assemblies.Count()} test assemblies"); var orderedList = OrderAssemblyList(options.Assemblies); var result = await testRunner.RunAllAsync(orderedList, cancellationToken).ConfigureAwait(true); var ellapsed = DateTime.Now - start; foreach (var assemblyPath in options.MissingAssemblies) { ConsoleUtil.WriteLine(ConsoleColor.Red, $"The file '{assemblyPath}' does not exist, is an invalid file name, or you do not have sufficient permissions to read the specified file."); } Logger.Finish(); if (CanUseWebStorage()) { await SendRunStats(options, testExecutor.DataStorage, ellapsed, result, cancellationToken).ConfigureAwait(true); } if (!result.Succeeded) { ConsoleUtil.WriteLine(ConsoleColor.Red, $"Test failures encountered: {ellapsed}"); return(1); } Console.WriteLine($"All tests passed: {ellapsed}"); return(options.MissingAssemblies.Any() ? 1 : 0); }
internal static int Main(string[] args) { var options = Options.Parse(args); if (options == null) { Options.PrintUsage(); return(1); } // Setup cancellation for ctrl-c key presses var cts = new CancellationTokenSource(); Console.CancelKeyPress += delegate { cts.Cancel(); }; ITestExecutor testExecutor = new ProcessTestExecutor(options); if (options.UseCachedResults) { testExecutor = new CachingTestExecutor(options, testExecutor, new LocalDataStorage()); } var testRunner = new TestRunner(options, testExecutor); var start = DateTime.Now; Console.WriteLine("Running {0} test assemblies", options.Assemblies.Count()); var orderedList = OrderAssemblyList(options.Assemblies); var result = testRunner.RunAllAsync(orderedList, cts.Token).Result; var span = DateTime.Now - start; foreach (var assemblyPath in options.MissingAssemblies) { ConsoleUtil.WriteLine(ConsoleColor.Red, $"The file '{assemblyPath}' does not exist, is an invalid file name, or you do not have sufficient permissions to read the specified file."); } Logger.Finish(); if (!result) { ConsoleUtil.WriteLine(ConsoleColor.Red, "Test failures encountered: {0}", span); return(1); } Console.WriteLine("All tests passed: {0}", span); return(options.MissingAssemblies.Any() ? 1 : 0); }
private static async Task <int> RunCore(Options options, CancellationToken cancellationToken) { if (!CheckAssemblyList(options)) { return(ExitFailure); } var testExecutor = CreateTestExecutor(options); var testRunner = new TestRunner(options, testExecutor); var start = DateTime.Now; var assemblyInfoList = GetAssemblyList(options); Console.WriteLine($"Data Storage: {testExecutor.DataStorage.Name}"); Console.WriteLine($"Running {options.Assemblies.Count()} test assemblies in {assemblyInfoList.Count} partitions"); var result = await testRunner.RunAllAsync(assemblyInfoList, cancellationToken).ConfigureAwait(true); var elapsed = DateTime.Now - start; Console.WriteLine($"Test execution time: {elapsed}"); Logger.Finish(Path.GetDirectoryName(options.Assemblies.FirstOrDefault() ?? "")); DisplayResults(options.Display, result.TestResults); if (CanUseWebStorage()) { await SendRunStats(options, testExecutor.DataStorage, elapsed, result, assemblyInfoList.Count, cancellationToken).ConfigureAwait(true); } if (!result.Succeeded) { ConsoleUtil.WriteLine(ConsoleColor.Red, $"Test failures encountered"); return(ExitFailure); } Console.WriteLine($"All tests passed"); return(ExitSuccess); }