static void Main(string[] args) { var runner = new TestRunProcess(new RunnerFeedback()); runner .WrapTestProcessWith(profilerWrapper) .ProcessTestRuns(getRunOptions()); //Console.ReadLine(); }
private void run(ProcessStartInfo startInfo, bool doNotshellExecute) { var channel = Guid.NewGuid().ToString(); var listener = startChannelListener(channel); var arguments = string.Format("--input=\"{0}\" --output=\"{1}\" --silent --channel=\"{2}\"", _input, _output, channel); if (_runInParallel) { arguments += " --run_assemblies_parallel"; } if (_startSuspended) { arguments += " --startsuspended"; } if (_compatabilityMode) { arguments += " --compatibility-mode"; } if (_feedback != null) { _feedback.ProcessStart(_executable + " " + arguments); } _proc = new Process(); _proc.StartInfo = startInfo; if (OS.IsPosix) { _proc.StartInfo.FileName = "mono"; _proc.StartInfo.Arguments = " --debug " + _executable + " " + arguments; } else { _proc.StartInfo.FileName = _executable; _proc.StartInfo.Arguments = arguments; } _proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; _proc.StartInfo.UseShellExecute = !doNotshellExecute; _proc.StartInfo.CreateNoWindow = true; _proc.StartInfo.WorkingDirectory = Path.GetDirectoryName(_executable); _proc.Start(); var abortListener = new System.Threading.Thread(listenForAborts); abortListener.Start(); _proc.WaitForExit(); closeClient(); if (listener != null) { listener.Join(); } abortListener.Join(); if (aborted()) { return; } var results = getResults(_output); TestRunProcess.AddResults(results); }
public TestRunResults[] RunTests(TestRunInfo[] runInfos) { var options = generateOptions(runInfos); if (options == null) return new TestRunResults[] { }; var runner = new TestRunProcess(new AutoTestRunnerFeedback()); var tests = runner.ProcessTestRuns(options); return getResults(tests, runInfos).ToArray(); }
public TestRunResults[] RunTests(TestRunInfo[] runInfos, Action<AutoTest.TestRunners.Shared.Targeting.Platform,Version,Action<ProcessStartInfo, bool>> processWrapper, Func<bool> abortWhen) { var options = generateOptions(runInfos); if (options == null) return new TestRunResults[] { }; AutoTestRunnerFeedback feedback = null; if (_handleRunnerFeedback) feedback = new AutoTestRunnerFeedback(_runCache, _bus, options); var runner = new TestRunProcess(feedback) .WrapTestProcessWith(processWrapper) .AbortWhen(abortWhen); if (_configuration.RunAssembliesInParallel) runner.RunParallel(); if (_configuration.TestRunnerCompatibilityMode) runner.RunInCompatibilityMode(); var tests = runner.ProcessTestRuns(options); return getResults(tests, runInfos).ToArray(); }
protected void ExecuteTestRunner() { var runner = new TestRunProcess(new RunnerFeedback()); runner .WrapTestProcessWith(ProfilerWrapper) .ProcessTestRuns(GetRunOptions()); var reader = new BinaryReader(_stream); reader.BaseStream.Position = 0; while (reader.BaseStream.Position < reader.BaseStream.Length) { var key = reader.ReadByte(); switch (key) { case 1: reader.ReadUInt32(); reader.ReadDouble(); reader.ReadInt32(); reader.ReadUInt64(); var info = new ResultsInfo(); info.RuntimeData = Encoding.Unicode.GetString(reader.ReadBytes(reader.ReadInt32() * 2)); info.MetaData = Encoding.Unicode.GetString(reader.ReadBytes(reader.ReadInt32() * 2)); ResultsInfos.Add(info); break; case 2: reader.ReadUInt32(); reader.ReadDouble(); reader.ReadInt32(); reader.ReadUInt64(); break; case 3: reader.ReadUInt32(); reader.ReadDouble(); reader.ReadInt32(); reader.ReadUInt64(); break; default: Assert.Fail("Validation failed {0} {1}", key, reader.BaseStream.Position); return; } } }
private void run(ProcessStartInfo startInfo) { var channel = Guid.NewGuid().ToString(); var listener = startChannelListener(channel); var arguments = string.Format("--input=\"{0}\" --output=\"{1}\" --silent --channel=\"{2}\"", _input, _output, channel); if (_runInParallel) { arguments += " --run_assemblies_parallel"; } if (_startSuspended) { arguments += " --startsuspended"; } if (_feedback != null) { _feedback.ProcessStart(_executable + " " + arguments); } _proc = new Process(); _proc.StartInfo = startInfo; _proc.StartInfo.FileName = _executable; _proc.StartInfo.Arguments = arguments; _proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; _proc.StartInfo.RedirectStandardOutput = true; _proc.StartInfo.UseShellExecute = false; _proc.StartInfo.CreateNoWindow = true; _proc.StartInfo.WorkingDirectory = Path.GetDirectoryName(_executable); _proc.Start(); new System.Threading.Thread(listenForAborts).Start(); _proc.StandardOutput.ReadToEnd(); _proc.WaitForExit(); if (aborted()) { listener.Abort(); return; } var results = getResults(_output); TestRunProcess.AddResults(results); }
public void Should_run_tests() { return; var options = new RunOptions(); var runner = new RunnerOptions("NUnit"); options.AddTestRun(runner); //runner.AddAssembly(new AssemblyOptions(@"C:\Users\ack\src\AutoTest.Net\src\AutoTest.TestRunner\Plugins\AutoTest.TestRunners.NUnit.Tests.TestResource\bin\Debug\AutoTest.TestRunners.NUnit.Tests.TestResource.dll")); runner.AddAssembly(new AssemblyOptions(@"C:\Users\Natalia\Documents\Repos\ic-AutoTest.NET4CTDD\2015\src\AutoTest.TestRunner\Plugins\AutoTest.TestRunners.NUnit.Tests.TestResource\bin\Debug\AutoTest.TestRunners.NUnit.Tests.TestResource.dll")); //runner.AddAssembly(new AssemblyOptions(@"C:\Users\ack\src\ClassLibrary1-v40\ClassLibrary1-v40\bin\AutoTest.Net\ClassLibrary1-v40.dll")); runner.AddAssembly(new AssemblyOptions(@"C:\Users\Natalia\Documents\Visual Studio 2015\Projects\ClassLibrary1\ClassLibrary1\bin\Debug\ClassLibrary1.dll")); //runner = new RunnerOptions("XUnit"); runner = new RunnerOptions("MSTest"); options.AddTestRun(runner); runner.AddAssembly(new AssemblyOptions(@"C:\Users\ack\src\AutoTest.Net\src\AutoTest.TestRunner\Plugins\AutoTest.TestRunners.XUnit.Tests.TestResource\bin\AutoTest.Net\AutoTest.TestRunners.XUnit.Tests.TestResource.dll")); var process = new TestRunProcess(new feedback()); var results = process.ProcessTestRuns(options); var sb = new StringBuilder(); sb.AppendLine(""); foreach (var result in results) sb.AppendLine(result.Runner + ", " + result.TestName + ", " + result.Message); throw new Exception(sb.ToString()); }