public TestRunResults RunTests(Project project, string assemblyName) { var timer = Stopwatch.StartNew(); var unitTestExe = _configuration.NunitTestRunner(project.Value.Framework); if (!File.Exists(unitTestExe)) return new TestRunResults(project.Key, assemblyName, new TestResult[] {}); var arguments = getExecutableArguments(assemblyName); var proc = new Process(); proc.StartInfo = new ProcessStartInfo(unitTestExe, arguments); proc.StartInfo.RedirectStandardOutput = true; proc.StartInfo.WorkingDirectory = Path.GetDirectoryName(assemblyName); proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; proc.StartInfo.UseShellExecute = false; proc.StartInfo.CreateNoWindow = true; proc.Start(); var parser = new NUnitTestResponseParser(_bus, project.Key, assemblyName); parser.Parse(proc.StandardOutput.ReadToEnd()); proc.WaitForExit(); timer.Stop(); var result = parser.Result; result.SetTimeSpent(timer.Elapsed); return result; }
public TestRunResults[] RunTests(TestRunInfo[] runInfos, Func<bool> abortWhen) { var results = new List<TestRunResults>(); // Get a list of the various nunit executables specified pr. framework version var nUnitExes = getNUnitExes(runInfos); foreach (var nUnitExe in nUnitExes) { // Get the assemblies that should be run under this nunit executable string tests; var assemblies = getAssembliesAndTestsForTestRunner(nUnitExe.Exe, runInfos, out tests); if (assemblies == null) continue; var arguments = getExecutableArguments(nUnitExe, assemblies, tests, runInfos); DebugLog.Debug.WriteInfo("Running tests: {0} {1}", nUnitExe.Exe, arguments); var proc = new Process(); proc.StartInfo = new ProcessStartInfo(nUnitExe.Exe, arguments); proc.StartInfo.RedirectStandardOutput = true; //proc.StartInfo.WorkingDirectory = Path.GetDirectoryName(runInfo.Assembly); proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; proc.StartInfo.UseShellExecute = false; proc.StartInfo.CreateNoWindow = true; proc.Start(); var parser = new NUnitTestResponseParser(_bus, TestRunner.NUnit); var nUnitResult = getNUnitOutput(proc.StandardOutput); parser.Parse(nUnitResult, runInfos, containsTests(arguments)); foreach (var result in parser.Result) results.Add(result); } return results.ToArray(); }
public TestRunResults RunTests(Project project, string assemblyName) { var timer = Stopwatch.StartNew(); var unitTestExe = _configuration.XunitTestRunner(project.Value.Framework); if (!File.Exists(unitTestExe)) return new TestRunResults(project.Key, assemblyName, new TestResult[] { }); var resultFile = Path.GetTempFileName(); var arguments = string.Format("\"{0}\" /noshadow /nunit \"{1}\"", assemblyName, resultFile); var proc = new Process(); proc.StartInfo = new ProcessStartInfo(unitTestExe, arguments); proc.StartInfo.RedirectStandardOutput = true; proc.StartInfo.WorkingDirectory = Path.GetDirectoryName(assemblyName); proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; proc.StartInfo.UseShellExecute = false; proc.StartInfo.CreateNoWindow = true; proc.Start(); // Make sure we empty buffer proc.StandardOutput.ReadToEnd(); proc.WaitForExit(); timer.Stop(); var parser = new NUnitTestResponseParser(_bus, project.Key, assemblyName); using (TextReader reader = new StreamReader(resultFile)) { parser.Parse(reader.ReadToEnd()); } File.Delete(resultFile); var result = parser.Result; result.SetTimeSpent(timer.Elapsed); return result; }
public void SetUp() { var bus = MockRepository.GenerateMock<IMessageBus>(); _parser = new NUnitTestResponseParser(bus, TestRunner.NUnit); var sources = new TestRunInfo[] { new TestRunInfo(new Project("project1", null), "/SomePath/AutoTest.WinForms.Test/bin/Debug/AutoTest.WinForms.Test.dll") }; _parser.Parse(File.ReadAllText("TestResources/NUnit/singleAssembly.txt"), sources, true); }
public void SetUp() { var bus = MockRepository.GenerateMock<IMessageBus>(); _parser = new NUnitTestResponseParser(bus); var sources = new TestRunInfo[] { new TestRunInfo(new Project("project1", null), string.Format("/home/ack/backup/WorkWin7/src/DotNET/Temp/SomeProjectUsingXUnit/bin/Debug/SomeProjectUsingXUnit.dll", Path.DirectorySeparatorChar)) }; _parser.Parse(File.ReadAllText("TestResources/NUnit/XUnitOutput.txt"), sources); }
public void SetUp() { var bus = MockRepository.GenerateMock<IMessageBus>(); _parser = new NUnitTestResponseParser(bus, TestRunner.NUnit); var sources = new TestRunInfo[] { new TestRunInfo(new Project("project1", null), "/home/ack/src/AutoTest.Net/src/AutoTest.TestCore/bin/Debug/AutoTest.TestCore.dll"), new TestRunInfo(new Project("project2", null), "/home/ack/src/AutoTest.Net/src/AutoTest.Test/bin/Debug/AutoTest.Test.dll"), new TestRunInfo(new Project("project3", null), "/home/ack/src/AutoTest.Net/src/AutoTest.WinForms.Test/bin/Debug/AutoTest.WinForms.Test.dll") }; _parser.Parse(File.ReadAllText("TestResources/NUnit/NewOutput.txt"), sources, false); }
public TestRunResults[] RunTests(TestRunInfo[] runInfos, Action <AutoTest.TestRunners.Shared.Targeting.Platform, Version, Action <ProcessStartInfo, bool> > processWrapper, Func <bool> abortWhen) { var results = new List <TestRunResults>(); foreach (var runInfo in runInfos) { var unitTestExe = _configuration.XunitTestRunner(getFramework(runInfo)); if (!File.Exists(unitTestExe)) { var project = ""; if (runInfo.Project != null) { project = runInfo.Project.Key; } results.Add(new TestRunResults(project, runInfo.Assembly, false, TestRunner.XUnit, new TestResult[] { })); continue; } var resultFile = Path.GetTempFileName(); var arguments = string.Format("\"{0}\" /noshadow /nunit \"{1}\"", runInfo.Assembly, resultFile); DebugLog.Debug.WriteInfo("Running tests: {0} {1}", unitTestExe, arguments); var proc = new Process(); proc.StartInfo = new ProcessStartInfo(unitTestExe, arguments); proc.StartInfo.RedirectStandardOutput = true; proc.StartInfo.WorkingDirectory = Path.GetDirectoryName(runInfo.Assembly); proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; proc.StartInfo.UseShellExecute = false; proc.StartInfo.CreateNoWindow = true; proc.Start(); // Make sure we empty buffer proc.StandardOutput.ReadToEnd(); proc.WaitForExit(); var parser = new NUnitTestResponseParser(_bus, TestRunner.XUnit); using (TextReader reader = new StreamReader(resultFile)) parser.Parse(reader.ReadToEnd(), runInfos, false); File.Delete(resultFile); foreach (var result in parser.Result) { results.Add(result); } } return(results.ToArray()); }
public TestRunResults[] RunTests(TestRunInfo[] runInfos) { var results = new List<TestRunResults>(); foreach (var runInfo in runInfos) { var unitTestExe = _configuration.XunitTestRunner(getFramework(runInfo)); if (!File.Exists(unitTestExe)) { var project = ""; if (runInfo.Project != null) project = runInfo.Project.Key; results.Add(new TestRunResults(project, runInfo.Assembly, false, TestRunner.XUnit, new TestResult[] { })); continue; } var resultFile = Path.GetTempFileName(); var arguments = string.Format("\"{0}\" /noshadow /nunit \"{1}\"", runInfo.Assembly, resultFile); DebugLog.Debug.WriteInfo("Running tests: {0} {1}", unitTestExe, arguments); var proc = new Process(); proc.StartInfo = new ProcessStartInfo(unitTestExe, arguments); proc.StartInfo.RedirectStandardOutput = true; proc.StartInfo.WorkingDirectory = Path.GetDirectoryName(runInfo.Assembly); proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; proc.StartInfo.UseShellExecute = false; proc.StartInfo.CreateNoWindow = true; proc.Start(); // Make sure we empty buffer proc.StandardOutput.ReadToEnd(); proc.WaitForExit(); var parser = new NUnitTestResponseParser(_bus, TestRunner.XUnit); using (TextReader reader = new StreamReader(resultFile)) parser.Parse(reader.ReadToEnd(), runInfos, false); File.Delete(resultFile); foreach (var result in parser.Result) results.Add(result); } return results.ToArray(); }
public TestRunResults[] RunTests(TestRunInfo[] runInfos, Action <AutoTest.TestRunners.Shared.Targeting.Platform, Action <ProcessStartInfo> > processWrapper, Func <bool> abortWhen) { var results = new List <TestRunResults>(); // Get a list of the various nunit executables specified pr. framework version var nUnitExes = getNUnitExes(runInfos); foreach (var nUnitExe in nUnitExes) { // Get the assemblies that should be run under this nunit executable string tests; var assemblies = getAssembliesAndTestsForTestRunner(nUnitExe.Exe, runInfos, out tests); if (assemblies == null) { continue; } var arguments = getExecutableArguments(nUnitExe, assemblies, tests, runInfos); DebugLog.Debug.WriteInfo("Running tests: {0} {1}", nUnitExe.Exe, arguments); var proc = new Process(); proc.StartInfo = new ProcessStartInfo(nUnitExe.Exe, arguments); proc.StartInfo.RedirectStandardOutput = true; //proc.StartInfo.WorkingDirectory = Path.GetDirectoryName(runInfo.Assembly); proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; proc.StartInfo.UseShellExecute = false; proc.StartInfo.CreateNoWindow = true; proc.Start(); var parser = new NUnitTestResponseParser(_bus, TestRunner.NUnit); var nUnitResult = getNUnitOutput(proc.StandardOutput); parser.Parse(nUnitResult, runInfos, containsTests(arguments)); foreach (var result in parser.Result) { results.Add(result); } } return(results.ToArray()); }
public void SetUp() { var bus = MockRepository.GenerateMock<IMessageBus>(); _parser = new NUnitTestResponseParser(bus, TestRunner.NUnit); var sources = new TestRunInfo[] { new TestRunInfo(new Project("project1", null), @"C:\Users\ack\src\SomeProject\SomeFile.dll") }; var text = File.ReadAllText("TestResources/NUnit/FailsToParse.txt"); text = text.Replace("\r\n", "").Replace("\n", ""); _parser.Parse(text, sources, true); }
public void SetUp() { var bus = MockRepository.GenerateMock<IMessageBus>(); _parser = new NUnitTestResponseParser(bus, "", ""); }