本文整理汇总了Java中org.kxml2.io.KXmlSerializer.startTag方法的典型用法代码示例。如果您正苦于以下问题:Java KXmlSerializer.startTag方法的具体用法?Java KXmlSerializer.startTag怎么用?Java KXmlSerializer.startTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kxml2.io.KXmlSerializer
的用法示例。
在下文中一共展示了KXmlSerializer.startTag方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: print
import org.kxml2.io.KXmlSerializer; //导入方法依赖的package包/类
private void print(KXmlSerializer serializer, String timestamp) throws IOException {
serializer.startTag(ns, XmlReportConstants.TESTSUITE);
serializer.attribute(ns, XmlReportConstants.ATTR_NAME, name);
serializer.attribute(ns, XmlReportConstants.ATTR_TESTS, Integer.toString(outcomes.size()));
serializer.attribute(ns, XmlReportConstants.ATTR_FAILURES, Integer.toString(failuresCount));
serializer.attribute(ns, XmlReportConstants.ATTR_ERRORS, Integer.toString(errorsCount));
serializer.attribute(ns, XmlReportConstants.ATTR_TIME, "0");
serializer.attribute(ns, XmlReportConstants.TIMESTAMP, timestamp);
serializer.attribute(ns, XmlReportConstants.HOSTNAME, "localhost");
serializer.startTag(ns, XmlReportConstants.PROPERTIES);
serializer.endTag(ns, XmlReportConstants.PROPERTIES);
for (Outcome outcome : outcomes) {
print(serializer, outcome);
}
serializer.endTag(ns, XmlReportConstants.TESTSUITE);
}
示例2: print
import org.kxml2.io.KXmlSerializer; //导入方法依赖的package包/类
void print(KXmlSerializer serializer, TestIdentifier testId, TestResult testResult)
throws IOException {
serializer.startTag(ns, TESTCASE);
serializer.attribute(ns, ATTR_NAME, getTestName(testId));
serializer.attribute(ns, ATTR_CLASSNAME, testId.getClassName());
long elapsedTimeMs = testResult.getEndTime() - testResult.getStartTime();
serializer.attribute(ns, ATTR_TIME, Double.toString((double)elapsedTimeMs / 1000.f));
switch (testResult.getStatus()) {
case FAILURE:
printFailedTest(serializer, FAILURE, testResult.getStackTrace());
break;
case ASSUMPTION_FAILURE:
printFailedTest(serializer, SKIPPED_TAG, testResult.getStackTrace());
break;
case IGNORED:
serializer.startTag(ns, SKIPPED_TAG);
serializer.endTag(ns, SKIPPED_TAG);
break;
}
serializer.endTag(ns, TESTCASE);
}
示例3: printFailure
import org.kxml2.io.KXmlSerializer; //导入方法依赖的package包/类
void printFailure(KXmlSerializer serializer, String type, Throwable t)
throws IOException {
serializer.startTag(ns, TESTCASE);
printAttributes(serializer);
serializer.startTag(ns, type);
String message = t.getMessage();
if (message != null && message.length() > 0) {
serializer.attribute(ns, ATTR_MESSAGE, t.getMessage());
}
serializer.attribute(ns, ATTR_TYPE, t.getClass().getName());
serializer.text(sanitize(BaseTestRunner.getFilteredTrace(t)));
serializer.endTag(ns, type);
serializer.endTag(ns, TESTCASE);
}
示例4: printTestResults
import org.kxml2.io.KXmlSerializer; //导入方法依赖的package包/类
void printTestResults(KXmlSerializer serializer, String timestamp, long elapsedTime)
throws IOException {
serializer.startTag(ns, TESTSUITE);
String name = getTestSuiteName();
if (name != null) {
serializer.attribute(ns, ATTR_NAME, name);
}
serializer.attribute(ns, ATTR_TESTS, Integer.toString(mRunResult.getNumTests()));
serializer.attribute(ns, ATTR_FAILURES, Integer.toString(
mRunResult.getNumAllFailedTests()));
// legacy - there are no errors in JUnit4
serializer.attribute(ns, ATTR_ERRORS, "0");
serializer.attribute(ns, ATTR_SKIPPED, Integer.toString(mRunResult.getNumTestsInState(
TestStatus.IGNORED)));
serializer.attribute(ns, ATTR_TIME, Double.toString((double) elapsedTime / 1000.f));
serializer.attribute(ns, TIMESTAMP, timestamp);
serializer.attribute(ns, HOSTNAME, mHostName);
serializer.startTag(ns, PROPERTIES);
for (Map.Entry<String,String> entry: getPropertiesAttributes().entrySet()) {
serializer.startTag(ns, PROPERTY);
serializer.attribute(ns, "name", entry.getKey());
serializer.attribute(ns, "value", entry.getValue());
serializer.endTag(ns, PROPERTY);
}
serializer.endTag(ns, PROPERTIES);
Map<TestIdentifier, TestResult> testResults = mRunResult.getTestResults();
for (Map.Entry<TestIdentifier, TestResult> testEntry : testResults.entrySet()) {
print(serializer, testEntry.getKey(), testEntry.getValue());
}
serializer.endTag(ns, TESTSUITE);
}
示例5: printFailedTest
import org.kxml2.io.KXmlSerializer; //导入方法依赖的package包/类
private void printFailedTest(KXmlSerializer serializer, String tag, String stack)
throws IOException {
serializer.startTag(ns, tag);
// TODO: get message of stack trace ?
// String msg = testResult.getStackTrace();
// if (msg != null && msg.length() > 0) {
// serializer.attribute(ns, ATTR_MESSAGE, msg);
// }
// TODO: get class name of stackTrace exception
// serializer.attribute(ns, ATTR_TYPE, testId.getClassName());
serializer.text(sanitize(stack));
serializer.endTag(ns, tag);
}
示例6: print
import org.kxml2.io.KXmlSerializer; //导入方法依赖的package包/类
void print(KXmlSerializer serializer, String timestamp) throws IOException {
serializer.startTag(ns, TESTSUITE);
serializer.attribute(ns, ATTR_NAME, name);
serializer.attribute(ns, ATTR_TESTS, Integer.toString(tests.size()));
serializer.attribute(ns, ATTR_FAILURES, Integer.toString(failures.size()));
serializer.attribute(ns, ATTR_ERRORS, Integer.toString(errors.size()));
serializer.attribute(ns, ATTR_TIME, "0");
serializer.attribute(ns, TIMESTAMP, timestamp);
serializer.attribute(ns, HOSTNAME, "localhost");
serializer.startTag(ns, PROPERTIES);
serializer.endTag(ns, PROPERTIES);
for (TestId testId : tests) {
TestFailure error = errors.get(testId);
TestFailure failure = failures.get(testId);
if (error != null) {
testId.printFailure(serializer, ERROR, error.thrownException());
} else if (failure != null) {
testId.printFailure(serializer, FAILURE, failure.thrownException());
} else {
testId.printSuccess(serializer);
}
}
serializer.endTag(ns, TESTSUITE);
}
示例7: printSuccess
import org.kxml2.io.KXmlSerializer; //导入方法依赖的package包/类
void printSuccess(KXmlSerializer serializer) throws IOException {
serializer.startTag(ns, TESTCASE);
printAttributes(serializer);
serializer.endTag(ns, TESTCASE);
}