code: private void createGroups(List<ISuite> suites,
                                File outputDirectory) throws Exception
      {
          int index = 1;
          for (ISuite suite : suites)
          {
              SortedMap<String, SortedSet<ITestNGMethod>> groups = sortGroups(suite.getMethodsByGroups());
              if (!groups.isEmpty())
              {
                  VelocityContext context = createContext();
                  context.put(SUITE_KEY, suite);
                  context.put(GROUPS_KEY, groups);
                  String fileName = String.format("suite%d_%s", index, GROUPS_FILE);
                  generateFile(new File(outputDirectory, fileName),
                               GROUPS_FILE + TEMPLATE_EXTENSION,
                               context);                
              }
              ++index;
          }
      }
docs: Generate a groups list for each suite.
  @param outputDirectory The target directory for the generated file(s).