Exemple #1
0
        private static ITestExecutor CreateTestExecutor(Options options)
        {
            var testExecutionOptions = new TestExecutionOptions(
                xunitPath: options.XunitPath,
                procDumpInfo: options.UseProcDump ? GetProcDumpInfo(options) : null,
                outputDirectory: options.TestResultXmlOutputDirectory,
                trait: options.Trait,
                noTrait: options.NoTrait,
                useHtml: options.UseHtml,
                test64: options.Test64,
                testVsi: options.TestVsi);
            var processTestExecutor = new ProcessTestExecutor(testExecutionOptions);

            if (!options.UseCachedResults)
            {
                return(processTestExecutor);
            }

            // The web caching layer is still being worked on.  For now want to limit it to Roslyn developers
            // and Jenkins runs by default until we work on this a bit more.  Anyone reading this who wants
            // to try it out should feel free to opt into this.
            IDataStorage dataStorage = new LocalDataStorage();

            if (CanUseWebStorage())
            {
                dataStorage = new WebDataStorage();
            }

            return(new CachingTestExecutor(processTestExecutor, dataStorage));
        }
Exemple #2
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);
        }
        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;
        }
Exemple #4
0
        private static ITestExecutor CreateTestExecutor(Options options)
        {
            var processTestExecutor = new ProcessTestExecutor(options);

            if (!options.UseCachedResults)
            {
                return(processTestExecutor);
            }

            // The web caching layer is still being worked on.  For now want to limit it to Roslyn developers
            // and Jenkins runs by default until we work on this a bit more.  Anyone reading this who wants
            // to try it out should feel free to opt into this.
            IDataStorage dataStorage = new LocalDataStorage();

            if (CanUseWebStorage())
            {
                dataStorage = new WebDataStorage();
            }

            return(new CachingTestExecutor(options, processTestExecutor, dataStorage));
        }
Exemple #5
0
 internal TestRunner(Options options, ProcessTestExecutor testExecutor)
 {
     _testExecutor = testExecutor;
     _options      = options;
 }
Exemple #6
0
        private static ITestExecutor CreateTestExecutor(Options options)
        {
            var processTestExecutor = new ProcessTestExecutor(options);
            if (!options.UseCachedResults)
            {
                return processTestExecutor;
            }

            // The web caching layer is still being worked on.  For now want to limit it to Roslyn developers
            // and Jenkins runs by default until we work on this a bit more.  Anyone reading this who wants
            // to try it out should feel free to opt into this. 
            IDataStorage dataStorage = new LocalDataStorage();
            if (CanUseWebStorage())
            {
                dataStorage = new WebDataStorage();
            }

            return new CachingTestExecutor(options, processTestExecutor, dataStorage);
        }