public void SetUp() { int a = 3; _plugin = new Plugin(typeof(Runner).Assembly.Location, typeof(Runner).FullName); _runner = _plugin.New(); }
private RunnerOptions getRunnerOptions(IEnumerable <TestRunInfo> unitInfos, IAutoTestNetTestRunner instance) { DebugLog.Debug.WriteDetail("Getting runner options for {0}", instance.Identifier); var runner = new RunnerOptions(instance.Identifier); var testRunner = TestRunnerConverter.FromString(instance.Identifier); foreach (var info in unitInfos) { DebugLog.Debug.WriteDetail("Handling {0}", info.Assembly); DebugLog.Debug.WriteDetail("About to add assembly"); var assembly = new AssemblyOptions(info.Assembly); assembly.AddTests(info.GetTestsFor(testRunner)); assembly.AddTests(info.GetTestsFor(TestRunner.Any)); DebugLog.Debug.WriteDetail("Found {0} tests for assembly", assembly.Tests.Count()); assembly.AddMembers(info.GetMembersFor(testRunner)); assembly.AddMembers(info.GetMembersFor(TestRunner.Any)); DebugLog.Debug.WriteDetail("Found {0} members for assembly", assembly.Members.Count()); assembly.AddNamespaces(info.GetNamespacesFor(testRunner)); assembly.AddNamespaces(info.GetNamespacesFor(TestRunner.Any)); DebugLog.Debug.WriteDetail("Found {0} namespaces for assembly", assembly.Namespaces.Count()); DebugLog.Debug.WriteDetail("Run only specified tests for runner {0} is {1}", testRunner, info.OnlyRunSpcifiedTestsFor(testRunner)); if (info.OnlyRunSpcifiedTestsFor(testRunner) && assembly.Tests.Count() == 0 && assembly.Members.Count() == 0 && assembly.Namespaces.Count() == 0) { continue; } DebugLog.Debug.WriteDetail("Adding assembly"); runner.AddAssembly(assembly); } return(runner); }
private static RunnerOptions getTestRunsFor(IAutoTestNetTestRunner instance, RunnerOptions run) { if (run.ID.ToLower() != "any") { return(run); } var newRun = new RunnerOptions(run.ID); newRun.AddCategories(run.Categories.ToArray()); foreach (var asm in run.Assemblies) { if (!asm.IsVerified && !instance.ContainsTestsFor(asm.Assembly)) { continue; } var assembly = new AssemblyOptions(asm.Assembly); assembly.AddNamespaces(asm.Namespaces.Where(x => asm.IsVerified || instance.ContainsTestsFor(asm.Assembly, x)).ToArray()); assembly.AddMembers(asm.Members.Where(x => asm.IsVerified || instance.ContainsTestsFor(asm.Assembly, x)).ToArray()); assembly.AddTests(asm.Tests.Where(x => asm.IsVerified || instance.IsTest(asm.Assembly, x)).ToArray()); if (hasNoTests(asm) || hasTests(assembly)) { newRun.AddAssembly(assembly); } } if (newRun.Assemblies.Count() == 0) { return(null); } return(newRun); }
private IEnumerable <string> getTests(OnDemandRun run, IAutoTestNetTestRunner runner) { var tests = new List <string>(); foreach (var test in run.Tests) { Logger.WriteDebug(string.Format("Checking {0} using {1} for test {2}", _assembly, runner.Identifier, test)); if (runner.IsTest(_assembly, test)) { Logger.WriteDebug(string.Format("{0} is a {1} test", test, runner.Identifier)); tests.Add(test); } } return(tests); }
private IEnumerable <string> getMemebers(OnDemandRun run, IAutoTestNetTestRunner runner) { var members = new List <string>(); foreach (var member in run.Members) { Logger.WriteDebug(string.Format("Checking {0} using {1} for memeber {2}", _assembly, runner.Identifier, member)); if (runner.ContainsTestsFor(_assembly, member)) { Logger.WriteDebug(string.Format("{0} contains {1} tests", member, runner.Identifier)); members.Add(member); } } return(members); }
private OnDemandRunInternal add(OnDemandRun run, IAutoTestNetTestRunner runner, IEnumerable<string> tests, IEnumerable<string> members, IEnumerable<string> namespaces) { if (alreadySetToTestAll(run)) return null; var existing = _list.Where(x => x.Project.Equals(run.Project) && x.Runner.Equals(TestRunnerConverter.FromString(runner.Identifier))).FirstOrDefault(); if (existing != null) { Logger.WriteDebug("Joining with existing run " + existing.Project + " with runner " + runner.Identifier); existing.JoinWith(tests, members, namespaces); return existing; } Logger.WriteDebug("Adding new run " + run.Project + " with runner " + runner.Identifier); var internalRun = new OnDemandRunInternal(TestRunnerConverter.FromString(runner.Identifier), run.Project, tests.ToArray(), members.ToArray(), namespaces.ToArray()); _list.Add(internalRun); return _list[_list.Count - 1]; }
private OnDemandRunInternal add(OnDemandRun run, IAutoTestNetTestRunner runner, IEnumerable <string> tests, IEnumerable <string> members, IEnumerable <string> namespaces) { if (alreadySetToTestAll(run)) { return(null); } var existing = _list.Where(x => x.Project.Equals(run.Project) && x.Runner.Equals(TestRunnerConverter.FromString(runner.Identifier))).FirstOrDefault(); if (existing != null) { Logger.WriteDebug("Joining with existing run " + existing.Project + " with runner " + runner.Identifier); existing.JoinWith(tests, members, namespaces); return(existing); } Logger.WriteDebug("Adding new run " + run.Project + " with runner " + runner.Identifier); var internalRun = new OnDemandRunInternal(TestRunnerConverter.FromString(runner.Identifier), run.Project, tests.ToArray(), members.ToArray(), namespaces.ToArray()); _list.Add(internalRun); return(_list[_list.Count - 1]); }
private static RunnerOptions getTestRunsFor(IAutoTestNetTestRunner instance, RunnerOptions run) { if (run.ID.ToLower() != "any") return run; var newRun = new RunnerOptions(run.ID); newRun.AddCategories(run.Categories.ToArray()); foreach (var asm in run.Assemblies) { if (!asm.IsVerified && !instance.ContainsTestsFor(asm.Assembly)) continue; var assembly = new AssemblyOptions(asm.Assembly); assembly.AddNamespaces(asm.Namespaces.Where(x => asm.IsVerified || instance.ContainsTestsFor(asm.Assembly, x)).ToArray()); assembly.AddMembers(asm.Members.Where(x => asm.IsVerified || instance.ContainsTestsFor(asm.Assembly, x)).ToArray()); assembly.AddTests(asm.Tests.Where(x => asm.IsVerified || instance.IsTest(asm.Assembly, x)).ToArray()); if (hasNoTests(asm) || hasTests(assembly)) newRun.AddAssembly(assembly); } if (newRun.Assemblies.Count() == 0) return null; return newRun; }
public void SetUp() { int a = 3; _plugin = new Plugin(typeof(Runner).Assembly.Location, typeof(Runner).FullName); _runner = _plugin.New(); }
private RunnerOptions getRunnerOptions(IEnumerable<TestRunInfo> unitInfos, IAutoTestNetTestRunner instance) { DebugLog.Debug.WriteDetail("Getting runner options for {0}", instance.Identifier); var runner = new RunnerOptions(instance.Identifier); runner.AddCategories(_configuration.TestCategoriesToIgnore); var testRunner = TestRunnerConverter.FromString(instance.Identifier); foreach (var info in unitInfos) { DebugLog.Debug.WriteDetail("Handling {0}", info.Assembly); DebugLog.Debug.WriteDetail("About to add assembly"); var assembly = new AssemblyOptions(info.Assembly); assembly.HasBeenVerified(true); assembly.AddTests(info.GetTestsFor(testRunner)); DebugLog.Debug.WriteDetail("Found {0} tests for assembly", assembly.Tests.Count()); assembly.AddMembers(info.GetMembersFor(testRunner)); DebugLog.Debug.WriteDetail("Found {0} members for assembly", assembly.Members.Count()); assembly.AddNamespaces(info.GetNamespacesFor(testRunner)); DebugLog.Debug.WriteDetail("Found {0} namespaces for assembly", assembly.Namespaces.Count()); DebugLog.Debug.WriteDetail("Run only specified tests for runner {0} is {1}", testRunner, info.OnlyRunSpcifiedTestsFor(testRunner)); if (info.OnlyRunSpcifiedTestsFor(testRunner) && assembly.Tests.Count() == 0 && assembly.Members.Count() == 0 && assembly.Namespaces.Count() == 0) continue; DebugLog.Debug.WriteDetail("Adding assembly"); runner.AddAssembly(assembly); } return runner; }
private void addEmtpyRun(OnDemandRun run, IAutoTestNetTestRunner runner) { _list.Add(new OnDemandRunInternal(TestRunnerConverter.FromString(runner.Identifier), run.Project, new string[] {}, new string[] {}, new string[] {})); }
private IEnumerable<string> getMemebers(OnDemandRun run, IAutoTestNetTestRunner runner) { var members = new List<string>(); foreach (var member in run.Members) { Logger.WriteDebug(string.Format("Checking {0} using {1} for memeber {2}", _assembly, runner.Identifier, member)); if (runner.ContainsTestsFor(_assembly, member)) { Logger.WriteDebug(string.Format("{0} contains {1} tests", member, runner.Identifier)); members.Add(member); } } return members; }
private void addEmtpyRun(OnDemandRun run, IAutoTestNetTestRunner runner) { _list.Add(new OnDemandRunInternal(TestRunnerConverter.FromString(runner.Identifier), run.Project, new string[] {}, new string[] {}, new string[] {})); }
private IEnumerable<string> getTests(OnDemandRun run, IAutoTestNetTestRunner runner) { var tests = new List<string>(); foreach (var test in run.Tests) { Logger.WriteDebug(string.Format("Checking {0} using {1} for test {2}", _assembly, runner.Identifier, test)); if (runner.IsTest(_assembly, test)) { Logger.WriteDebug(string.Format("{0} is a {1} test", test, runner.Identifier)); tests.Add(test); } } return tests; }