org.testng.internal.Utils.writeUtf8File()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(104)

本文整理了Java中org.testng.internal.Utils.writeUtf8File()方法的一些代码示例,展示了Utils.writeUtf8File()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.writeUtf8File()方法的具体详情如下:
包路径:org.testng.internal.Utils
类名称:Utils
方法名:writeUtf8File

Utils.writeUtf8File介绍

[英]Writes the content of the sb string to the file named filename in outDir encoding the output as UTF-8. If outDir does not exist, it is created.
[中]将sb字符串的内容写入outDir中名为filename的文件,并将输出编码为UTF-8。如果outDir不存在,则会创建它。

代码示例

代码示例来源:origin: org.testng/testng

private void writeSuiteToFile(File suiteFile, ISuite suite) {
 XMLStringBuffer xmlBuffer = new XMLStringBuffer();
 writeSuiteToBuffer(xmlBuffer, suite);
 File parentDir = suiteFile.getParentFile();
 suiteFile.getParentFile().mkdirs();
 if (parentDir.exists() || suiteFile.getParentFile().exists()) {
  Utils.writeUtf8File(parentDir.getAbsolutePath(), FILE_NAME, xmlBuffer.toXML());
 }
}

代码示例来源:origin: cbeust/testng

private void writeSuiteToFile(File suiteFile, ISuite suite) {
 XMLStringBuffer xmlBuffer = new XMLStringBuffer();
 writeSuiteToBuffer(xmlBuffer, suite);
 File parentDir = suiteFile.getParentFile();
 suiteFile.getParentFile().mkdirs();
 if (parentDir.exists() || suiteFile.getParentFile().exists()) {
  Utils.writeUtf8File(parentDir.getAbsolutePath(), fileName(), xmlBuffer.toXML());
 }
}

代码示例来源:origin: org.testng/testng

Utils.writeUtf8File(context.getOutputDirectory(),generateFileName(context) + ".xml", document.toXML());

代码示例来源:origin: cbeust/testng

Utils.writeUtf8File(
  context.getOutputDirectory(), generateFileName(context) + ".xml", document.toXML());

代码示例来源:origin: org.testng/testng

protected void generateFailureSuite(XmlSuite xmlSuite, ISuite suite, String outputDir) {
 XmlSuite failedSuite = xmlSuite.shallowCopy();
 failedSuite.setName("Failed suite [" + xmlSuite.getName() + "]");
 m_xmlSuite= failedSuite;
 Map<String, ISuiteResult> results = suite.getResults();
  for(Map.Entry<String, ISuiteResult> entry : results.entrySet()) {
   ISuiteResult suiteResult = entry.getValue();
   ITestContext testContext = suiteResult.getTestContext();
   generateXmlTest(testContext.getCurrentXmlTest(),
           testContext,
           testContext.getFailedTests().getAllResults(),
           testContext.getSkippedTests().getAllResults());
  }
 if(null != failedSuite.getTests() && failedSuite.getTests().size() > 0) {
  Utils.writeUtf8File(outputDir, TESTNG_FAILED_XML, failedSuite.toXml());
  Utils.writeUtf8File(suite.getOutputDirectory(), TESTNG_FAILED_XML, failedSuite.toXml());
 }
}

代码示例来源:origin: org.testng/testng

/**
 * Writes the specified ISuiteResult in the given XMLStringBuffer. Please consider that depending on the settings in
 * the <code>config</code> property it might generate an additional XML file with the actual content and only
 * reference the file with an <code>url</code> attribute in the passed XMLStringBuffer.
 *
 * @param xmlBuffer   The XML buffer where to write or reference the suite result
 * @param suiteResult The <code>ISuiteResult</code> to serialize
 */
public void writeSuiteResult(XMLStringBuffer xmlBuffer, ISuiteResult suiteResult) {
 if (XMLReporterConfig.FF_LEVEL_SUITE_RESULT != config.getFileFragmentationLevel()) {
  writeAllToBuffer(xmlBuffer, suiteResult);
 } else {
  String parentDir =
      config.getOutputDirectory() + File.separatorChar + suiteResult.getTestContext().getSuite().getName();
  File file = referenceSuiteResult(xmlBuffer, parentDir, suiteResult);
  XMLStringBuffer suiteXmlBuffer = new XMLStringBuffer();
  writeAllToBuffer(suiteXmlBuffer, suiteResult);
  Utils.writeUtf8File(file.getAbsoluteFile().getParent(), file.getName(), suiteXmlBuffer.toXML());
 }
}

代码示例来源:origin: org.testng/testng

Utils.writeUtf8File(config.getOutputDirectory(), fileName(), rootBuffer, null /* no prefix */);

代码示例来源:origin: cbeust/testng

/**
 * Writes the specified ISuiteResult in the given XMLStringBuffer. Please consider that depending
 * on the settings in the <code>config</code> property it might generate an additional XML file
 * with the actual content and only reference the file with an <code>url</code> attribute in the
 * passed XMLStringBuffer.
 *
 * @param xmlBuffer The XML buffer where to write or reference the suite result
 * @param suiteResult The <code>ISuiteResult</code> to serialize
 */
public void writeSuiteResult(XMLStringBuffer xmlBuffer, ISuiteResult suiteResult) {
 if (XMLReporterConfig.FF_LEVEL_SUITE_RESULT != config.getFileFragmentationLevel()) {
  writeAllToBuffer(xmlBuffer, suiteResult);
 } else {
  String parentDir =
    config.getOutputDirectory()
      + File.separatorChar
      + suiteResult.getTestContext().getSuite().getName();
  File file = referenceSuiteResult(xmlBuffer, parentDir, suiteResult);
  XMLStringBuffer suiteXmlBuffer = new XMLStringBuffer();
  writeAllToBuffer(suiteXmlBuffer, suiteResult);
  Utils.writeUtf8File(
    file.getAbsoluteFile().getParent(), file.getName(), suiteXmlBuffer.toXML());
 }
}

代码示例来源:origin: cbeust/testng

protected void generateFailureSuite(XmlSuite xmlSuite, ISuite suite, String outputDir) {
 XmlSuite failedSuite = xmlSuite.shallowCopy();
 failedSuite.setName("Failed suite [" + xmlSuite.getName() + "]");
 m_xmlSuite = failedSuite;
 Map<String, ISuiteResult> results = suite.getResults();
 for (Map.Entry<String, ISuiteResult> entry : results.entrySet()) {
  ISuiteResult suiteResult = entry.getValue();
  ITestContext testContext = suiteResult.getTestContext();
  generateXmlTest(
    testContext.getCurrentXmlTest(),
    testContext,
    testContext.getFailedTests().getAllResults(),
    testContext.getSkippedTests().getAllResults());
 }
 if (null != failedSuite.getTests() && failedSuite.getTests().size() > 0) {
  Utils.writeUtf8File(outputDir, TESTNG_FAILED_XML, failedSuite.toXml());
  Utils.writeUtf8File(suite.getOutputDirectory(), TESTNG_FAILED_XML, failedSuite.toXml());
 }
}

代码示例来源:origin: org.testng/testng

Utils.writeUtf8File(m_outputDirectory, "index.html", xsb, all);

代码示例来源:origin: cbeust/testng

Utils.writeUtf8File(config.getOutputDirectory(), fileName(), rootBuffer, null /* no prefix */);

代码示例来源:origin: org.testng/testng

Utils.writeUtf8File(outputDirectory, getFileName(cls), xsb.toXML());

代码示例来源:origin: cbeust/testng

Utils.writeUtf8File(m_outputDirectory, "index.html", xsb, all);

代码示例来源:origin: cbeust/testng

Utils.writeUtf8File(outputDirectory, getFileName(cls), xsb.toXML());

代码示例来源:origin: org.infinispan/infinispan-commons-test

Utils.writeUtf8File(suite.getOutputDirectory().replaceAll(".Surefire suite", ""),
   generateFileName(suite) + ".xml", document.toXML());

代码示例来源:origin: HotelsDotCom/heat

Utils.writeUtf8File(REPORT_PATH, REPORT_NAME, document.toXML());

代码示例来源:origin: com.hotels/heat-core-utils

Utils.writeUtf8File(REPORT_PATH, REPORT_NAME, document.toXML());

相关文章