@Override public String[] getGroups() { return testNGMethod.getGroups(); }
private TestNgRunStateTracker.EventLogBuilder buildEventLog(ITestResult result, TestNgRunEvent event) { return(buildEventLog(result.getTestContext(), event)) .addData(METHOD_NAME, result.getMethod().getMethodName()) .addData(CLASS_NAME, result.getMethod().getRealClass().getCanonicalName()) .addData(CLASS_INSTANCE, result.getMethod().getInstance()) .addData(GROUPS_DEPENDED_ON, result.getMethod().getGroupsDependedUpon()) .addData(METHODS_DEPENDED_ON, result.getMethod().getMethodsDependedUpon()) .addData(GROUPS_BELONGING_TO, result.getMethod().getGroups()); }
@Override public String[] getGroups() { return m_method.getGroups(); }
@Override public String[] getGroups() { return testNGMethod.getGroups(); }
@Override public String[] getGroups() { return m_method.getGroups(); }
private boolean belongToSameGroup(ITestResult result) { ITestNGMethod m = result.getMethod(); if (!m.isBeforeGroupsConfiguration()) { return false; } String[] mygroups = this.m_method.getGroups(); if (mygroups.length == 0 || m.getGroups().length ==0) { return false; } List<String> cfgMethodGroups = Arrays.asList(m.getGroups()); return Arrays.stream(mygroups).anyMatch(cfgMethodGroups::contains); }
private String qualifiedName(ITestNGMethod method) { StringBuilder addon = new StringBuilder(); String[] groups = method.getGroups(); int length = groups.length; if (length > 0 && !"basic".equalsIgnoreCase(groups[0])) { addon.append("("); for (int i = 0; i < length; i++) { if (i > 0) { addon.append(", "); } addon.append(groups[i]); } addon.append(")"); } return "<b>" + method.getMethodName() + "</b> " + addon; }
private Map<String, List<ITestNGMethod>> initializeAfterGroupsMap() { Map<String, List<ITestNGMethod>> result= Maps.newConcurrentMap(); for(ITestNGMethod m : m_allMethods) { String[] groups= m.getGroups(); for(String g : groups) { List<ITestNGMethod> methodsInGroup= result.get(g); if(null == methodsInGroup) { methodsInGroup= Lists.newArrayList(); result.put(g, methodsInGroup); } methodsInGroup.add(m); } } afterGroupsThatHaveAlreadyRun.clear(); return result; }
private static String[] getAllGroups(Class<?> declaringClass, XmlTest xmlTest, IAnnotationFinder annotationFinder) { // Find the groups of the factory => all groups of all test methods ITestMethodFinder testMethodFinder = new TestNGMethodFinder(new RunInfo(), annotationFinder); ITestNGMethod[] testMethods = testMethodFinder.getTestMethods(declaringClass, xmlTest); Set<String> groups = new HashSet<>(); for (ITestNGMethod method : testMethods) { groups.addAll(Arrays.asList(method.getGroups())); } return groups.toArray(new String[groups.size()]); }
/** * @param methods list of methods to search * @param groupRegexp regex representing the group * * @return all the methods that belong to the group specified by the regular * expression groupRegExp. methods[] is the list of all the methods we * are choosing from. */ protected static ITestNGMethod[] findMethodsThatBelongToGroup(ITestNGMethod[] methods, String groupRegexp) { List<ITestNGMethod> vResult = Lists.newArrayList(); final Pattern pattern = getPattern(groupRegexp); for (ITestNGMethod tm : methods) { String[] groups = tm.getGroups(); for (String group : groups) { Boolean match = isMatch(pattern, group); if (match) { vResult.add(tm); } } } return vResult.toArray(new ITestNGMethod[vResult.size()]); }
/** * @see org.testng.ISuite#getMethodsByGroups() */ @Override public Map<String, Collection<ITestNGMethod>> getMethodsByGroups() { Map<String, Collection<ITestNGMethod>> result = Maps.newHashMap(); for (TestRunner tr : testRunners) { ITestNGMethod[] methods = tr.getAllTestMethods(); for (ITestNGMethod m : methods) { String[] groups = m.getGroups(); for (String groupName : groups) { Collection<ITestNGMethod> testMethods = result.get(groupName); if (null == testMethods) { testMethods = Lists.newArrayList(); result.put(groupName, testMethods); } testMethods.add(m); } } } return result; }
private static String[] getAllGroups( Class<?> declaringClass, XmlTest xmlTest, IAnnotationFinder annotationFinder) { // Find the groups of the factory => all groups of all test methods ITestMethodFinder testMethodFinder = new TestNGMethodFinder(new RunInfo(), annotationFinder); ITestNGMethod[] testMethods = testMethodFinder.getTestMethods(declaringClass, xmlTest); Set<String> groups = new HashSet<>(); for (ITestNGMethod method : testMethods) { groups.addAll(Arrays.asList(method.getGroups())); } return groups.toArray(new String[0]); }
public DependencyMap(ITestNGMethod[] methods) { for (ITestNGMethod m : methods) { m_dependencies.put( m.getQualifiedName(), m); for (String g : m.getGroups()) { m_groups.put(g, m); } } }
private static boolean doesConfigMethodPassGroupFilters( ConfigurationMethod cm, ITestNGMethod tm) { String[] groupFilters = cm.getGroupFilters(); if (groupFilters.length == 0) { return true; // no group filters means all groups accepted } String[] groups = tm.getGroups(); if (groups.length == 0) { return false; // a method with no groups won't pass any filter } return !Collections.disjoint(Sets.newHashSet(groups), Sets.newHashSet(groupFilters)); } }
@Override public boolean includeMethod(IMethodSelectorContext context, ITestNGMethod method, boolean isTestMethod) { for (String group : method.getGroups()) { if (group.equals("test2")) { context.setStopped(true); return true; } } return false; }
@Override public boolean includeMethod( IMethodSelectorContext context, ITestNGMethod method, boolean isTestMethod) { if (ALL.equalsIgnoreCase(whichGroup)) { return true; } boolean isEqual = Arrays.equals(new String[]{whichGroup}, method.getGroups()); if (context != null) { context.setStopped(true); } return isEqual; }
public DependencyMap(ITestNGMethod[] methods) { for (ITestNGMethod m : methods) { m_dependencies.put(m.getQualifiedName(), m); for (String g : m.getGroups()) { m_groups.put(g, m); } } }
private void updateGroups(ISuite suite, ITestResult tr) { String[] groups = tr.getMethod().getGroups(); m_groupsBySuiteName.putAll(suite.getName(), Arrays.asList(groups)); for (String group : groups) { m_methodsByGroup.put(group, tr.getMethod().getMethodName()); } }
private void updateGroups(ISuite suite, ITestResult tr) { String[] groups = tr.getMethod().getGroups(); m_groupsBySuiteName.putAll(suite.getName(), Arrays.asList(groups)); for (String group : groups) { m_methodsByGroup.put(group, tr.getMethod().getMethodName()); } }
@Override public void afterInvocation(IInvokedMethod method, ITestResult testResult) { String methodname = method.getTestMethod().getMethodName(); mapping.put(methodname, Arrays.asList(method.getTestMethod().getGroups())); }