Exemple #1
0
        public Process StartProcess(TestBatch testBatch, string defaultArgs)
        {
            var xunitArgs = string.Format("{0} {1} {2} {3} {4}", defaultArgs, ParallelXunitCommandLine.StartArgument, testBatch.Start, ParallelXunitCommandLine.EndArgument, testBatch.End);
            if (_silent)
                xunitArgs += " /silent";

            if (_teamCity)
                xunitArgs += " /teamcity";

            Process = new Process();
            Process.StartInfo.FileName = "pxunit.console.exe";
            Process.StartInfo.Arguments = xunitArgs;
            Process.StartInfo.RedirectStandardOutput = true;
            Process.StartInfo.UseShellExecute = false;
            Process.OutputDataReceived += WriteToStdOut;

            Process.Start();
            Process.BeginOutputReadLine();

            AddWaitHandle();

            return Process;
        }
Exemple #2
0
        public Process StartProcess(TestBatch testBatch)
        {
            WaitForOneProcess();

            var xunitArgs = string.Format("{0} {1} {2} {3} {4}", DefaultArgs, ParallelXunitCommandLine.StartArgument, testBatch.Start, ParallelXunitCommandLine.EndArgument, testBatch.End);
            if (Silent)
                xunitArgs += " /silent";

            if (TeamCity)
                xunitArgs += " /teamcity";

            var process = new Process();
            process.StartInfo.FileName = "pxunit.console.exe";
            process.StartInfo.Arguments = xunitArgs;
            process.StartInfo.RedirectStandardOutput = true;
            process.StartInfo.UseShellExecute = false;
            process.OutputDataReceived += (sender, eventArgs) =>
                                              {
                                                  var p = (Process)sender;
                                                  //Console.WriteLine(eventArgs.Data);
                                                  Console.WriteLine(string.Format("{0}: {1}", p.Id, eventArgs.Data));

                                                  var lines = _output.GetOrAdd(p.Id, new List<string>());
                                                  lines.Add(eventArgs.Data);
                                              };

            process.Start();
            process.BeginOutputReadLine();

            Processes.TryAdd(process.Id, process);
            AddWaitHandle(process);

            return process;
        }
        public TestBatch GetNextBatch()
        {
            var batchSize = _batchSize;
            if (NextStartIndex + _batchSize > _numberOfTestMethods)
            {
                batchSize = _numberOfTestMethods - NextStartIndex;
                batchSize = batchSize < 0 ? 0 : batchSize;
            }

            var batch = new TestBatch(NextStartIndex, batchSize);
            NextStartIndex += _batchSize;

            return batch;
        }
Exemple #4
0
        public Process StartProcess(TestBatch testBatch)
        {
            WaitForOneProcess();

            var processInfo = new ProcessInfo(TeamCity, Silent);
            var process = processInfo.StartProcess(testBatch, DefaultArgs);

            Processes.TryAdd(processInfo.Pid, processInfo);

            return process;
        }