XmlSuiteResultFormatter
public
class
XmlSuiteResultFormatter
extends Object
implements
IFormatterGenerator
java.lang.Object | |
↳ | com.android.tradefed.result.suite.XmlSuiteResultFormatter |
Utility class to save a suite run as an XML. TODO: Remove all the special Compatibility Test format work around to get the same format.
Summary
Nested classes | |
---|---|
class |
XmlSuiteResultFormatter.RunHistory
Helper object for JSON conversion. |
Fields | |
---|---|
public
static
final
String |
NS
|
public
static
final
String |
TEST_RESULT_FILE_NAME
|
Public constructors | |
---|---|
XmlSuiteResultFormatter()
|
Public methods | |
---|---|
void
|
addBuildInfoAttributes(XmlSerializer serializer, SuiteResultHolder holder)
Allows to add some attributes to the |
void
|
addSuiteAttributes(XmlSerializer serializer)
Allows to add some attributes to the |
void
|
parseBuildInfoAttributes(XmlPullParser parser, IInvocationContext context)
Reverse operation from |
SuiteResultHolder
|
parseResults(File resultDir, boolean shallow)
Reverse operation of |
void
|
parseSuiteAttributes(XmlPullParser parser, IInvocationContext context)
Reverse operation from |
static
String
|
sanitizeXmlContent(String s)
Sanitizes a string to escape the special characters. |
static
String
|
truncateStackTrace(String fullStackTrace, String testCaseName)
Truncates the full stack trace with maximum |
File
|
writeResults(SuiteResultHolder holder, File resultDir)
Write the invocation results in an xml format. |
Fields
NS
public static final String NS
TEST_RESULT_FILE_NAME
public static final String TEST_RESULT_FILE_NAME
Public constructors
XmlSuiteResultFormatter
public XmlSuiteResultFormatter ()
Public methods
addBuildInfoAttributes
public void addBuildInfoAttributes (XmlSerializer serializer, SuiteResultHolder holder)
Allows to add some attributes to the serializer.attribute
.
Parameters | |
---|---|
serializer |
XmlSerializer : The object that serializes an XML suite result. |
holder |
SuiteResultHolder : An object that contains information to be written to the suite result. |
addSuiteAttributes
public void addSuiteAttributes (XmlSerializer serializer)
Allows to add some attributes to the serializer.attribute
.
Parameters | |
---|---|
serializer |
XmlSerializer : The object that serializes an XML suite result. |
parseBuildInfoAttributes
public void parseBuildInfoAttributes (XmlPullParser parser, IInvocationContext context)
Reverse operation from addBuildInfoAttributes(org.xmlpull.v1.XmlSerializer, com.android.tradefed.result.suite.SuiteResultHolder)
.
Parameters | |
---|---|
parser |
XmlPullParser : The parser where to read the attributes from. |
context |
IInvocationContext : The IInvocationContext where to put the attributes. |
Throws | |
---|---|
XmlPullParserException |
When XmlPullParser fails. |
parseResults
public SuiteResultHolder parseResults (File resultDir, boolean shallow)
Reverse operation of writeResults(com.android.tradefed.result.suite.SuiteResultHolder, File)
which takes a result
directory and create the SuiteResultHolder
out of it.
Parameters | |
---|---|
resultDir |
File : The directory where to find the results. |
shallow |
boolean : only load the top level information of SuiteResultHolder . |
Returns | |
---|---|
SuiteResultHolder |
A SuiteResultHolder containing the results representation. Or null if
anything goes wrong. |
parseSuiteAttributes
public void parseSuiteAttributes (XmlPullParser parser, IInvocationContext context)
Reverse operation from addSuiteAttributes(org.xmlpull.v1.XmlSerializer)
.
Parameters | |
---|---|
parser |
XmlPullParser : The parser where to read the attributes from. |
context |
IInvocationContext : The IInvocationContext where to put the attributes. |
Throws | |
---|---|
XmlPullParserException |
When XmlPullParser fails. |
sanitizeXmlContent
public static String sanitizeXmlContent (String s)
Sanitizes a string to escape the special characters.
Parameters | |
---|---|
s |
String |
Returns | |
---|---|
String |
truncateStackTrace
public static String truncateStackTrace (String fullStackTrace, String testCaseName)
Truncates the full stack trace with maximum ERROR(/STACK_TRACE_MAX_SIZE)
characters.
Parameters | |
---|---|
fullStackTrace |
String |
testCaseName |
String |
Returns | |
---|---|
String |
writeResults
public File writeResults (SuiteResultHolder holder, File resultDir)
Write the invocation results in an xml format.
Parameters | |
---|---|
holder |
SuiteResultHolder : a SuiteResultHolder holding all the info required for the xml |
resultDir |
File : the result directory ERROR(/File) where to put the results. |
Returns | |
---|---|
File |
a ERROR(/File) pointing to the xml output file. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2024-07-02 UTC.