private IEnumerable <TestNodeClass> BuildTestTree(IDictionary <string, List <string> > testFixtures) { foreach (var testFixture in testFixtures) { var c = new TestNodeClass(testFixture.Key.Split('.').Last()) { Namespace = testFixture.Key.Substring(0, testFixture.Key.LastIndexOf('.')), }; foreach (var testCase in testFixture.Value) { string testName = testCase; var nodeMethod = new TestNodeMethod(c, testName) { TestId = new NUnitTestId(testCase), Identifier = CreateIdentifier(testCase), }; c.Children.Add(nodeMethod); } if (c.Children.Any()) { yield return(c); } } }
public IEnumerable <TestNodeNamespace> CreateMutantTestTree(List <TmpTestNodeMethod> nodeMethods) { var list = nodeMethods.GroupBy(n => ExtractTypeName(n.Name)).ToList(); TestsRootNode root = new TestsRootNode(); var u = new Utilss(); u.GroupTypes <IGrouping <string, TmpTestNodeMethod>, TestTreeNode>( root, n => ExtractTypeName(n.Key), (parent, name) => new TestNodeNamespace(parent, name), (parent, collection) => { foreach (var grouping in collection) { var testNodeClass = new TestNodeClass(ExtractName(grouping.Key)); testNodeClass.Parent = parent; parent.Children.Add(testNodeClass); foreach (var tmpMethod in grouping) { var testNodeMethod = new TestNodeMethod(testNodeClass, ExtractName(tmpMethod.Name)); testNodeMethod.State = tmpMethod.State; testNodeMethod.Message = tmpMethod.Message; testNodeClass.Children.Add(testNodeMethod); } } }, list); return(root.Children.Cast <TestNodeNamespace>()); }
public IEnumerable<TestNodeNamespace> CreateMutantTestTree(List<TmpTestNodeMethod> nodeMethods) { var list = nodeMethods.GroupBy(n => ExtractTypeName(n.Name)).ToList(); TestsRootNode root = new TestsRootNode(); var u = new Utilss(); u.GroupTypes<IGrouping<string, TmpTestNodeMethod>, TestTreeNode>( root, n => ExtractTypeName(n.Key), (parent, name) => new TestNodeNamespace(parent, name), (parent, collection) => { foreach (var grouping in collection) { var testNodeClass = new TestNodeClass(ExtractName(grouping.Key)); testNodeClass.Parent = parent; parent.Children.Add(testNodeClass); foreach (var tmpMethod in grouping) { var testNodeMethod = new TestNodeMethod(testNodeClass, ExtractName(tmpMethod.Name)); testNodeMethod.State = tmpMethod.State; testNodeMethod.Message = tmpMethod.Message; testNodeClass.Children.Add(testNodeMethod); } } }, list); return root.Children.Cast<TestNodeNamespace>(); }
public override void Visit(INamespaceTypeDefinition type) { string nsName = type.ContainingUnitNamespace.ResolvedUnitNamespace.ToString(); _currentClass = new TestNodeClass(type.Name.Value) { Namespace = nsName }; _classes.Add(_currentClass); }
private IEnumerable <TestNodeClass> BuildTestTree(ITest test) { IEnumerable <ITest> classes = GetTestClasses(test).ToList(); foreach (ITest testClass in classes.Where(c => c.Tests != null && c.Tests.Count != 0)) { var c = new TestNodeClass(testClass.TestName.Name) { Namespace = testClass.Parent.TestName.FullName, // FullName = testClass.TestName.FullName, }; foreach (ITest testMethod in testClass.Tests.Cast <ITest>()) { if (_nUnitWrapper.NameFilter == null || _nUnitWrapper.NameFilter.Match(testMethod)) { string testName = testMethod.TestName.FullName; //if(!context.TestMap.ContainsKey(testName)) // { var nodeMethod = new TestNodeMethod(c, testName) { TestId = new NUnitTestId(testMethod.TestName), Identifier = CreateIdentifier(testMethod), }; c.Children.Add(nodeMethod); // _log.Debug("Adding test: " + testName); // context.TestMap.Add(testName, nodeMethod); // } // else // { // _log.Debug("Already exists test: " + testName); // //TODO: handle he case where parametrized test method may be present duplicated. // } } } if (c.Children.Any()) { yield return(c); } } }