Example #1
0
        public static void Execute(
            Action <Action> dispatcher,
            IEnumerable <string> arguments)
        {
            WorkbookAppInstallation.RegisterProcessManagers(typeof(TestRunner).Assembly);

            AgentIdentificationManager.DefaultTimeout = TimeSpan.FromSeconds(5);

            ProcessControl.Exec.Log += (sender, e) => {
                if (e.ExitCode == null)
                {
                    Console.WriteLine($"Exec[{e.ExecId}]: {e.Arguments}");
                }
                else
                {
                    Console.WriteLine($"Exec[{e.ExecId}]: exited {e.ExitCode}");
                }
            };

            var args = new List <string> ();

            args.AddRange(new string[] {
                "-labels=All",
                "-noheader",
                "-workers=1"
            });

            args.AddRange(arguments.Where(a => !a.StartsWith("-psn_", StringComparison.Ordinal)));

            Environment.CurrentDirectory = new FilePath(
                typeof(TestRunner).Assembly.Location).ParentDirectory;

            TextRunner.MainLoop = new MainLoopIntegration(dispatcher);

            Console.WriteLine(string.Join(" ", args));

            new TextRunner().Execute(args.ToArray());
        }