void () { Map<String, Map<String, List<String>>> map = new LinkedHashMap<>(); final boolean findTestMethodsForClass = shouldSearchForTestMethods(); for (final Map.Entry<PsiClass, Map<PsiMethod, List<String>>> entry : myClasses.entrySet()) { final Map<PsiMethod, List<String>> depMethods = entry.getValue(); LinkedHashMap<String, List<String>> methods = new LinkedHashMap<>(); for (Map.Entry<PsiMethod, List<String>> method : depMethods.entrySet()) { methods.put(method.getKey().getName(), method.getValue()); } if (findTestMethodsForClass && depMethods.isEmpty()) { for (PsiMethod method : entry.getKey().getMethods()) { if (TestNGUtil.hasTest(method)) { methods.put(method.getName(), Collections.emptyList()); } } } final String className = ReadAction.compute(() -> ClassUtil.getJVMClassName(entry.getKey())); if (className != null) { map.put(className, methods); } } // We have groups we wish to limit to. Collection<String> groupNames = myConfig.calculateGroupNames(); Map<String, String> testParams = buildTestParameters(); int logLevel = 1; try { final Properties properties = new Properties(); properties.load(new ByteArrayInputStream(myConfig.getVMParameters().getBytes(StandardCharsets.UTF_8))); final String verbose = properties.getProperty("-Dtestng.verbose"); if (verbose != null) { logLevel = Integer.parseInt(verbose); } } catch (Exception ignore) { //not a number } File xmlFile; if (groupNames != null) { final LinkedHashMap<String, Collection<String>> methodNames = new LinkedHashMap<>(); for (Map.Entry<String, Map<String, List<String>>> entry : map.entrySet()) { methodNames.put(entry.getKey(), entry.getValue().keySet()); } LaunchSuite suite = SuiteGenerator.createSuite(myProject.getName(), null, methodNames, groupNames, testParams, "jdk", logLevel); xmlFile = suite.save(new File(PathManager.getSystemPath())); } else { XmlSuite suite = new XmlSuite(); suite.setParameters(testParams); String programParameters = myConfig.getProgramParameters(); if (programParameters != null && ParametersListUtil.parse(programParameters).contains("-threadcount")) { suite.setThreadCount(-1); } xmlFile = TestNGXmlSuiteHelper.writeSuite(map, myProject.getName(), PathManager.getSystemPath(), new TestNGXmlSuiteHelper.Logger() { @Override public void log(Throwable e) { LOG.error(e); } }, requireToDowngradeToHttp(), suite); } String path = xmlFile.getAbsolutePath() + "\n"; try { FileUtil.writeToFile(myTempFile, path.getBytes(StandardCharsets.UTF_8), true); } catch (IOException e) { LOG.error(e); } }