public FieldTestControl(IEditorNavigator navigator, IOutputWriter outputWriter, IDebugAttacher debugAttacher) { _navigator = navigator; _outputWriter = outputWriter; _debugAttacher = debugAttacher; InitializeComponent(); _viewModel = new FieldTestViewModel(); _viewModel.CanRunTests = false; DataContext = _viewModel; }
protected virtual void RunTests(IEnumerable <TestDetails> tests, IDebugAttacher debuggerAttacher) { if (_outputWriter != null) { _outputWriter.ClearOutput(); } var testAssemblies = tests.Select(t => t.Class.Assembly).Distinct(); foreach (var assembly in testAssemblies) { var runnerPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\FieldTest.Runner.exe"; _configManager.CopyApplicationConfiguration(string.Format("{0}.config", assembly.AssemblyPath), string.Format("{0}.config", runnerPath)); _testExecutor.RunTests(tests, assembly, runnerPath, debuggerAttacher); } }
public void RunTests(IEnumerable <TestDetails> tests, TestAssembly assembly, string runnerPath, IDebugAttacher debuggerAttacher) { Dictionary <string, TestDetails> testHashTable = new Dictionary <string, TestDetails>(); ProcessStartInfo testRunnerStartParameters = new ProcessStartInfo() { FileName = runnerPath, RedirectStandardOutput = true, UseShellExecute = false, RedirectStandardInput = true, RedirectStandardError = true, CreateNoWindow = true, WindowStyle = ProcessWindowStyle.Hidden }; using (var testRunnerProcess = new Process()) { testRunnerProcess.StartInfo = testRunnerStartParameters; testRunnerProcess.OutputDataReceived += new DataReceivedEventHandler(testRunnerProcess_OutputDataReceived); testRunnerProcess.Start(); if (debuggerAttacher != null) { debuggerAttacher.AttachToProcess(testRunnerProcess.Id); } testRunnerProcess.BeginOutputReadLine(); ProcessTests(assembly, tests, testRunnerProcess.StandardInput); //var runnerResult = testRunnerProcess.StandardOutput.ReadToEnd(); // ProcessTestResults("", testHashTable); _testWaitHandle = new AutoResetEvent(false); _testWaitHandle.WaitOne(); } }
public void DebugTests(IEnumerable <TestDetails> tests, IDebugAttacher debuggerAttacher) { RunTests(tests, debuggerAttacher); }