public void Should_build_the_command_line_for_each_run() { _configuration .Stub(x => x.MSpecTestRunner("framework 1")) .Return("c:\\runner 1.exe"); _configuration .Stub(x => x.MSpecTestRunner("framework 2")) .Return("c:\\runner 2.exe"); _fileSystem .Stub(x => x.FileExists(null)) .IgnoreArguments() .Return(true); var document1 = new ProjectDocument(ProjectType.CSharp); document1.SetFramework("framework 1"); var info1 = new TestRunInfo(new Project("key 1", document1), "assembly 1"); var document2 = new ProjectDocument(ProjectType.CSharp); document2.SetFramework("framework 2"); var info2 = new TestRunInfo(new Project("key 2", document2), "assembly 2"); var testRunInfos = new[] { info1, info2 }; _runner.RunTests(testRunInfos, null); _commandLineBuilder.AssertWasCalled(x => x.Build(null), o => o.IgnoreArguments().Repeat.Twice()); }
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 void Should_locate_removed_test_in_partial_test_run() { int i = 3; var results = new TestRunResults("project1", "assembly", false, new TestResult[] { new TestResult(TestRunner.NUnit, TestRunStatus.Failed, "Test1"), new TestResult(TestRunner.NUnit, TestRunStatus.Ignored, "Test2"), new TestResult(TestRunner.NUnit, TestRunStatus.Failed, "Test3"), new TestResult(TestRunner.NUnit, TestRunStatus.Failed, "Test4") }); var cache = new RunResultCache(); cache.Merge(results); var infos = new TestRunInfo[] { new TestRunInfo(new Project("project", new ProjectDocument(ProjectType.CSharp)), "assembly") }; infos[0].AddTestsToRun(new TestToRun[] { new TestToRun(TestRunner.NUnit, "Test1"), new TestToRun(TestRunner.NUnit, "Test2"), new TestToRun(TestRunner.NUnit, "Test3") }); results = new TestRunResults("project1", "assembly", true, new TestResult[] { new TestResult(TestRunner.NUnit, TestRunStatus.Ignored, "Test1") }); var locator = new RemovedTestsLocator(cache); results = locator.SetRemovedTestsAsPassed(results, infos); results.Passed.Length.ShouldEqual(2); results.Passed[0].Name.ShouldEqual("Test3"); results.Passed[1].Name.ShouldEqual("Test2"); }
private string getTestsList(TestRunInfo runInfo) { var tests = ""; foreach (var test in runInfo.TestsToRun) tests += string.Format("/run:{0} ", test); return tests; }
public List<TestRunResults> RemoveUnmatchedRunInfoTests(TestRunResults[] results, TestRunInfo[] infos) { var tests = new List<TestItem>(); tests.AddRange(_cache.Failed); tests.AddRange(_cache.Ignored); var removed = new List<TestRunResults>(); infos .Where(i => results.Count(x => i.Assembly.Equals(x.Assembly)) == 0).ToList() .ForEach(i => { tests.Where(x => x.Key.Equals(i.Assembly) && (!i.OnlyRunSpcifiedTestsFor(x.Value.Runner) || i.GetTestsFor(x.Value.Runner).Count(t => t.Equals(x.Value.Name)) > 0)) .GroupBy(x => x.Value.Runner).ToList() .ForEach(x => { removed.Add(new TestRunResults( i.Project.Key, i.Assembly, i.OnlyRunSpcifiedTestsFor(TestRunner.Any), x.Key, x.Select(t => new TestResult( t.Value.Runner, TestRunStatus.Passed, t.Value.Name, t.Value.Message, t.Value.StackTrace, t.Value.TimeSpent.TotalMilliseconds).SetDisplayName(t.Value.DisplayName)).ToArray())); }); }); return removed; }
private TestRunResults[] getResults(IEnumerable<AutoTest.TestRunners.Shared.Results.TestResult> tests, TestRunInfo[] runInfos) { var results = new List<TestRunResults>(); foreach (var byRunner in tests.GroupBy(x => x.Runner)) { var runner = TestRunnerConverter.FromString(byRunner.Key); foreach (var byAssembly in byRunner.GroupBy(x => x.Assembly)) { var info = runInfos.Where(x => x.Assembly.Equals(byAssembly.Key)).FirstOrDefault(); var project = ""; var partial = false; if (info != null) { if (info.Project != null) project = info.Project.Key; partial = info.OnlyRunSpcifiedTestsFor(runner) || info.GetTestsFor(runner).Count() > 0 || info.GetMembersFor(runner).Count() > 0 || info.GetNamespacesFor(runner).Count() > 0; } DebugLog.Debug.WriteDetail(string.Format("Partial run is {0} for runner {1}", partial, runner)); var result = new TestRunResults( project, byAssembly.Key, partial, runner, byAssembly.Select(x => ConvertResult(x)).ToArray()); result.SetTimeSpent(TimeSpan.FromMilliseconds(byAssembly.Sum(x => x.DurationInMilliseconds))); results.Add(result); } } return results.ToArray(); }
private TestRunResults getTestResults(TestRunInfo runInfo) { string project = ""; if (runInfo.Project != null) project = runInfo.Project.Key; return new TestRunResults(project, runInfo.Assembly, _result.ToArray()); }
public void Should_not_remove_tests_from_different_runners() { var cache = new RunResultCache(); cache.EnabledDeltas(); var results = new TestRunResults("project", "assembly", false, TestRunner.NUnit, new TestResult[] { new TestResult(TestRunner.NUnit, TestRunStatus.Failed, "Test1"), }); cache.Merge(results); var mah = cache.PopDeltas(); mah.AddedTests.Length.ShouldEqual(1); var infos = new TestRunInfo[] { new TestRunInfo(new Project("project", new ProjectDocument(ProjectType.CSharp)), "assembly") }; results = new TestRunResults("project", "assembly", false, TestRunner.XUnit, new TestResult[] { new TestResult(TestRunner.XUnit, TestRunStatus.Failed, "Test1"), }); var locator = new RemovedTestsLocator(cache); results = locator.SetRemovedTestsAsPassed(results, infos); cache.Merge(results); results.Passed.Length.ShouldEqual(0); var meh = cache.PopDeltas(); meh.RemovedTests.Length.ShouldEqual(0); }
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 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 SetRemovedTestsAsPassed(TestRunResults results, TestRunInfo[] infos) { _results = results; _infos = infos; var tests = new List<TestResult>(); tests.AddRange(results.All); tests.AddRange(getTests(_cache.Failed)); tests.AddRange(getTests(_cache.Ignored)); var modified = new TestRunResults(_results.Project, _results.Assembly, _results.IsPartialTestRun, _results.Runner, tests.ToArray()); modified.SetTimeSpent(_results.TimeSpent); return modified; }
public void Should_report_the_time_info() { var document = new ProjectDocument(ProjectType.CSharp); document.SetFramework("framework 1"); var info = new TestRunInfo(new Project("key 1", document), "assembly 1"); var infos = new[] { info }; var run = new MSpecTestRunner.Run { RunInfos = infos }; var args = _builder.Build(run); Assert.That(args, Is.StringContaining("--timeinfo")); }
private string[] getNUnitExes(TestRunInfo[] runInfos) { var testRunnerExes = new List<string>(); foreach (var runInfo in runInfos) { var unitTestExe = _configuration.NunitTestRunner(getFramework(runInfo)); if (File.Exists(unitTestExe)) { if (!testRunnerExes.Exists(x => x.Equals(unitTestExe))) testRunnerExes.Add(unitTestExe); } } return testRunnerExes.ToArray(); }
public void Should_create_the_assembly_list_from_distinct_assembly_names() { var document = new ProjectDocument(ProjectType.CSharp); document.SetFramework("framework 1"); var info1 = new TestRunInfo(new Project("key 1", document), "assembly 1"); var info2 = new TestRunInfo(new Project("key 2", document), "assembly 1"); var infos = new[] { info1, info2 }; var run = new MSpecTestRunner.Run { RunInfos = infos }; var args = _builder.Build(run); var assembly1Count = new Regex("assembly 1").Matches(args).Count; Assert.That(assembly1Count, Is.EqualTo(1)); }
public void Should_create_the_assembly_list() { var document = new ProjectDocument(ProjectType.CSharp); document.SetFramework("framework 1"); var info1 = new TestRunInfo(new Project("key 1", document), "assembly 1"); var info2 = new TestRunInfo(new Project("key 2", document), "assembly 2"); var infos = new[] { info1, info2 }; var run = new MSpecTestRunner.Run { RunInfos = infos }; var args = _builder.Build(run); Assert.That(args, Is.StringContaining(" \"assembly 1\"")); Assert.That(args, Is.StringContaining(" \"assembly 2\"")); }
public void Should_create_an_xml_report() { var document = new ProjectDocument(ProjectType.CSharp); document.SetFramework("framework 1"); var info = new TestRunInfo(new Project("key 1", document), "assembly 1"); var infos = new[] { info }; var run = new MSpecTestRunner.Run { RunInfos = infos }; var args = _builder.Build(run); Assert.That(args, Is.StringContaining("--xml")); Assert.That(run.Cleanups.Count(), Is.EqualTo(1)); Assert.That(run.Harvesters.Count(), Is.EqualTo(1)); }
private RunnerExe[] getNUnitExes(TestRunInfo[] runInfos) { var testRunnerExes = new List<RunnerExe>(); foreach (var runInfo in runInfos) { var framework = getFramework(runInfo); var unitTestExe = _configuration.NunitTestRunner(framework); if (_configuration.GetSpesificNunitTestRunner(framework) == null) framework = ""; if (File.Exists(unitTestExe)) { if (!testRunnerExes.Exists(x => x.Equals(new RunnerExe(unitTestExe, framework)))) testRunnerExes.Add(new RunnerExe(unitTestExe, framework)); } } return testRunnerExes.ToArray(); }
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 timer = Stopwatch.StartNew(); var unitTestExe = _configuration.MSTestRunner(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.MSTest, new TestResult[] { })); continue; } if (runInfo.OnlyRunSpcifiedTestsFor(TestRunner.MSTest) && runInfo.GetTestsFor(TestRunner.MSTest).Length.Equals(0)) continue; var calc = new MaxCmdLengthCalculator(); var tests = getTestsList(runInfo); var testRunConfig = getTestrunConfigArguments(); var arguments = "/testcontainer:\"" + runInfo.Assembly + "\" " + tests + " /detail:errorstacktrace /detail:errormessage" + testRunConfig; var runAllTests = (arguments.Length + unitTestExe.Length) > calc.GetLength(); if (runAllTests) arguments = "/testcontainer:\"" + runInfo.Assembly + "\"" + " /detail:errorstacktrace /detail:errormessage" + testRunConfig; 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(); string line; var parser = new MSTestResponseParser(runInfo.Project.Key, runInfo.Assembly, !runAllTests); while ((line = proc.StandardOutput.ReadLine()) != null) parser.ParseLine(line); proc.WaitForExit(); timer.Stop(); parser.Result.SetTimeSpent(timer.Elapsed); results.Add(parser.Result); } return results.ToArray(); }
public TestRunInfo CloneToTestRunInfo() { var runInfo = new TestRunInfo(Project, Assembly); runInfo.AddTestsToRun(GetTests()); runInfo.AddMembersToRun(GetMembers()); runInfo.AddNamespacesToRun(GetNamespaces()); foreach (var runner in _onlyRunTestsFor) { runInfo.ShouldOnlyRunSpcifiedTestsFor(runner); } foreach (var runner in _rerunAllWhenFinishedFor) { runInfo.ShouldRerunAllTestWhenFinishedFor(runner); } return(runInfo); }
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(); }
public void Parse(string content, TestRunInfo[] runInfos, bool isPartialTestRun) { _content = content; _testSources = runInfos; _isPartialTestRuns = isPartialTestRun; var testSuites = getTestSuites(); Debug.WriteDetail(string.Format("Found {0} test sections", testSuites.Length)); foreach (var testSuite in testSuites) { _result.Clear(); string[] testCases = getTestCases(testSuite); Debug.WriteDetail(string.Format("Found {0} test cases in section {1}", testCases.Length, getAssemblyName(testSuite))); foreach (var testCase in testCases) { string name = getname(testCase); var status = TestRunStatus.Passed; if (testCase.Contains("executed=\"False\"")) status = TestRunStatus.Ignored; else if (testCase.Contains("success=\"False\"")) status = TestRunStatus.Failed; string message = ""; if (status.Equals(TestRunStatus.Ignored)) message = getMessage(testCase); else if (status.Equals(TestRunStatus.Failed)) message = getMessage(testCase); IStackLine[] stackTrace = new IStackLine[] {}; if (status.Equals(TestRunStatus.Failed)) stackTrace = getStackTrace(testCase); _result.Add(new TestResult(_runner, status, name, message, stackTrace)); } var runInfo = matchToTestSource(testSuite); if (runInfo == null) { Debug.WriteError("Could not match test suite {0} to any of the tested assemblies", getAssemblyName(testSuite)); continue; } var results = getTestResults(runInfo); results.SetTimeSpent(getTimeSpent(testSuite)); _runResults.Add(results); } }
public TestRunResults[] RunTests(TestRunInfo[] runInfos) { var results = new List<TestRunResults>(); foreach (var runInfo in runInfos) { var timer = Stopwatch.StartNew(); var unitTestExe = _configuration.MSTestRunner(getFramework(runInfo)); if (!File.Exists(unitTestExe)) { var project = ""; if (runInfo.Project != null) project = runInfo.Project.Key; results.Add(new TestRunResults(project, runInfo.Assembly, new TestResult[] { })); continue; } if (runInfo.OnlyRunSpcifiedTests && runInfo.TestsToRun.Length.Equals(0)) continue; var tests = getTestsList(runInfo); var arguments = "/testcontainer:\"" + runInfo.Assembly + "\" " + tests + " /detail:errorstacktrace /detail:errormessage"; DebugLog.Debug.WriteMessage(string.Format("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(); string line; var parser = new MSTestResponseParser(runInfo.Project.Key, runInfo.Assembly); while ((line = proc.StandardOutput.ReadLine()) != null) parser.ParseLine(line); proc.WaitForExit(); timer.Stop(); parser.Result.SetTimeSpent(timer.Elapsed); results.Add(parser.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 void Parse(string content, TestRunInfo[] runInfos) { _content = content; _testSources = runInfos; var testSuites = getTestSuites(); foreach (var testSuite in testSuites) { _result.Clear(); string[] testCases = getTestCases(testSuite); foreach (var testCase in testCases) { string name = getname(testCase); var status = TestRunStatus.Passed; if (testCase.Contains("executed=\"False\"")) status = TestRunStatus.Ignored; else if (testCase.Contains("success=\"False\"")) status = TestRunStatus.Failed; string message = ""; if (status.Equals(TestRunStatus.Ignored)) message = getMessage(testCase); else if (status.Equals(TestRunStatus.Failed)) message = getMessage(testCase); IStackLine[] stackTrace = new IStackLine[] {}; if (status.Equals(TestRunStatus.Failed)) stackTrace = getStackTrace(testCase); _result.Add(new TestResult(status, name, message, stackTrace)); } var runInfo = matchToTestSource(testSuite); if (runInfo == null) continue; var results = getTestResults(runInfo); results.SetTimeSpent(getTimeSpent(testSuite)); _runResults.Add(results); } }
public void Should_rerun_test_if_pre_processor_says_so() { _runInfo.ShouldNotBuild(); _project.Value.SetOutputPath(""); _project.Value.SetAssemblyName("someProject.dll"); var info = new TestRunInfo(_project, ""); _listGenerator.Stub(l => l.Generate(null)).IgnoreArguments().Return(new string[] { "some file.csproj" }); _configuration.Stub(c => c.BuildExecutable(_project.Value)).Return("invalid_to_not_run_builds.exe"); var result = new TestRunResults[] { new TestRunResults("", "", false, TestRunner.NUnit, new TestResult[] { }) }; _testRunner.Stub(t => t.CanHandleTestFor(info.Assembly)).IgnoreArguments().Return(true); _testRunner.Stub(t => t.RunTests(new TestRunInfo[] { info })).IgnoreArguments() .Return(result); _runInfo.ShouldRerunAllTestWhenFinishedFor(TestRunner.Any); _removedTestLocator.Stub(r => r.SetRemovedTestsAsPassed(null, null)).IgnoreArguments().Return(result[0]); _testAssemblyValidator.Stub(t => t.ShouldNotTestAssembly("")).IgnoreArguments().Return(false); var message = new ProjectChangeMessage(); message.AddFile(new ChangedFile("some file.csproj")); _consumer.Consume(message); _testRunner.AssertWasCalled(t => t.RunTests(new TestRunInfo[] { new TestRunInfo(null, "") }), t => t.IgnoreArguments().Repeat.Twice()); }
private string getAssembliesAndTestsForTestRunner(string testRunnerExes, TestRunInfo[] runInfos, out string tests) { var separator = getArgumentSeparator(); var assemblies = ""; tests = ""; foreach (var runInfo in runInfos) { DebugLog.Debug.WriteDetail("About to add {0}", runInfo.Assembly); var unitTestExe = _configuration.NunitTestRunner(getFramework(runInfo)); if (unitTestExe.Equals(testRunnerExes)) { DebugLog.Debug.WriteDetail("It only run specified tests is {0} and test count is {1}", runInfo.OnlyRunSpcifiedTestsFor(TestRunner.NUnit), runInfo.GetTestsFor(TestRunner.NUnit).Length); if (runInfo.OnlyRunSpcifiedTestsFor(TestRunner.NUnit) && runInfo.GetTestsFor(TestRunner.NUnit).Length.Equals(0)) continue; assemblies += string.Format("\"{0}\"", runInfo.Assembly) + " "; var assemblyTests = getTestsList(runInfo); DebugLog.Debug.WriteDetail("Test list is {0}", assemblyTests); if (assemblyTests.Length > 0) tests += (tests.Length > 0 ? "," : "") + assemblyTests; } } if (tests.Length > 0) tests = string.Format("{0}run={1}", separator, tests); if (assemblies.Length.Equals(0)) return null; return assemblies; }
string getExecutableArguments (RunnerExe exe, string assemblyName, string tests, TestRunInfo[] runInfos) { var calc = new MaxCmdLengthCalculator(); var separator = getArgumentSeparator(); string framework = ""; // only use framework for windows as the default runner on linux has no framework parameter if (!Environment.OSVersion.Platform.Equals(PlatformID.Unix) && !Environment.OSVersion.Platform.Equals(PlatformID.MacOSX)) { if (exe.Version.Length > 0) framework = string.Format(" {0}framework:{1}", separator, exe.Version); } var categoryList = getCategoryIgnoreList(); var arguments = string.Format("{0}noshadow{2} {0}xmlconsole {1}", separator, categoryList, framework) + assemblyName + " " + tests; if ((arguments.Length + exe.Exe.Length) > calc.GetLength()) arguments = string.Format("{0}noshadow{2} {0}xmlconsole {1}", separator, categoryList, framework) + assemblyName; return arguments; }
private string getFramework(TestRunInfo runInfo) { if (runInfo.Project == null) return ""; return runInfo.Project.Value.Framework; }
private string getTestsList(TestRunInfo runInfo) { var tests = ""; foreach (var test in runInfo.GetTestsFor(TestRunner.NUnit)) tests += (tests.Length > 0 ? "," : "") + test; return tests; }