MetricTestCase
public
class
MetricTestCase
extends TestCase
java.lang.Object | |||
↳ | junit.framework.Assert | ||
↳ | junit.framework.TestCase | ||
↳ | com.android.tradefed.testtype.MetricTestCase |
Extension of TestCase
that allows to log metrics when running as part of TradeFed. Either
directly as a DeviceTestCase
or as part of a HostTest
. TODO: Evaluate if having
run metric (not only test metric) make sense for JUnit3 tests.
Summary
Nested classes | |
---|---|
class |
MetricTestCase.LogHolder
Structure to hold a log file to be reported. |
Fields | |
---|---|
public
|
mLogs
|
public
|
mMetrics
|
Public constructors | |
---|---|
MetricTestCase()
|
|
MetricTestCase(String name)
Constructs a test case with the given name. |
Public methods | |
---|---|
final
void
|
addTestLog(String dataName, LogDataType dataType, InputStreamSource dataStream)
Callback from JUnit3 forwarder in order to get the logs from a test. |
final
void
|
addTestMetric(String key, MetricMeasurement.Metric metric)
|
final
void
|
addTestMetric(String key, String value)
Log a metric for the test case. |
Fields
mLogs
publicmLogs
mMetrics
publicmMetrics
Public constructors
MetricTestCase
public MetricTestCase ()
MetricTestCase
public MetricTestCase (String name)
Constructs a test case with the given name. Inherited from TestCase
constructor.
Parameters | |
---|---|
name |
String |
Public methods
addTestLog
public final void addTestLog (String dataName, LogDataType dataType, InputStreamSource dataStream)
Callback from JUnit3 forwarder in order to get the logs from a test.
Parameters | |
---|---|
dataName |
String : a String descriptive name of the data. e.g. "device_logcat". Note dataName
may not be unique per invocation. ie implementers must be able to handle multiple calls
with same dataName |
dataType |
LogDataType : the LogDataType of the data |
dataStream |
InputStreamSource : the InputStreamSource of the data. Implementers should call
createInputStream to start reading the data, and ensure to close the resulting
InputStream when complete. Callers should ensure the source of the data remains present
and accessible until the testLog method completes. |
addTestMetric
public final void addTestMetric (String key, MetricMeasurement.Metric metric)
Parameters | |
---|---|
key |
String |
metric |
MetricMeasurement.Metric |
addTestMetric
public final void addTestMetric (String key, String value)
Log a metric for the test case.
Parameters | |
---|---|
key |
String : the key under which the metric will be found. |
value |
String : associated to the key. |
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 2023-03-08 UTC.