public void Run(string testExecutable, string testName, ITestOutput output) { var commandLineGenerator = new CommandLineGenerator(); var options = TestRunnerOptions.FromDteProperties(_dte.Properties["BoostTest", "TestRunner"]); var testRunnerProcess = new ChildProcess(commandLineGenerator.Generate(testExecutable, testName, options)); testRunnerProcess.StartSuspended(); var process = _dte.Debugger.LocalProcesses.Cast<EnvDTE.Process>().SingleOrDefault(p => p.ProcessID == testRunnerProcess.Pid); if (process == null) { throw new InvalidOperationException("Couldn't find the process : " + testExecutable); } process.Attach(); testRunnerProcess.Resume() .ContinueWith( x => { if (x.IsCompleted) { output.Clear(); output.OutputString(DateTime.Now.ToLongTimeString() + " : Test (Debug) : " + testName + "\n"); output.OutputString(x.Result); } }); }
public void CanGenerateCommandLine() { var options = new TestRunnerOptions { DetectMemoryLeaks = false }; var commandLineGenerator = new CommandLineGenerator(); var commandLine = commandLineGenerator.Generate("run_tests.exe", "my_test", options); Assert.AreEqual("run_tests.exe -t my_test --detect_memory_leaks=0", commandLine); }
public void Run(string testExecutable, string testName, ITestOutput output) { var commandLineGenerator = new CommandLineGenerator(); var options = TestRunnerOptions.FromDteProperties(_dte.Properties["BoostTest", "TestRunner"]); var commandLine = commandLineGenerator.Generate(testExecutable, testName, options); var testRunnerProcess = new ChildProcess(commandLine); testRunnerProcess.Start() .ContinueWith( result => { if (result.IsCompleted) { output.Clear(); output.OutputString(DateTime.Now.ToLongTimeString() + " : Test : " + testName + "\n"); output.OutputString(result.Result); } }); }