use of org.testng.xml.XmlSuite in project buck by facebook.
the class TestNGRunner method createXmlSuite.
private XmlSuite createXmlSuite(Class<?> c) {
XmlSuite xmlSuite = new XmlSuite();
xmlSuite.setName("TmpSuite");
xmlSuite.setTimeOut(String.valueOf(defaultTestTimeoutMillis));
XmlTest xmlTest = new XmlTest(xmlSuite);
xmlTest.setName("TmpTest");
xmlTest.setXmlClasses(Collections.singletonList(new XmlClass(c)));
return xmlSuite;
}
use of org.testng.xml.XmlSuite in project intellij-community by JetBrains.
the class SearchingForTestsTask method composeTestSuiteFromXml.
private void composeTestSuiteFromXml() throws CantRunException {
final Map<String, String> buildTestParams = buildTestParameters();
try {
if (buildTestParams.isEmpty()) {
String path = new File(myData.getSuiteName()).getAbsolutePath() + "\n";
FileUtil.writeToFile(myTempFile, path.getBytes(CharsetToolkit.UTF8_CHARSET), true);
return;
}
final Parser parser = new Parser(myData.getSuiteName());
parser.setLoadClasses(false);
final Collection<XmlSuite> suites = parser.parse();
for (XmlSuite suite : suites) {
Map<String, String> params = suite.getParameters();
params.putAll(buildTestParams);
final String fileId = FileUtil.sanitizeFileName(myProject.getName() + '_' + suite.getName() + '_' + Integer.toHexString(suite.getName().hashCode()) + ".xml");
final File suiteFile = new File(PathManager.getSystemPath(), fileId);
FileWriter fileWriter = new FileWriter(suiteFile);
try {
fileWriter.write(suite.toXml());
} finally {
fileWriter.close();
}
String path = suiteFile.getAbsolutePath() + "\n";
FileUtil.writeToFile(myTempFile, path.getBytes(CharsetToolkit.UTF8_CHARSET), true);
}
} catch (Exception e) {
throw new CantRunException("Unable to parse suite: " + e.getMessage());
}
}
Aggregations