BasePostProcessor
public
abstract
class
BasePostProcessor
extends Object
implements
IPostProcessor
java.lang.Object
|
↳ |
com.android.tradefed.postprocessor.BasePostProcessor
|
Known direct subclasses
AggregatePostProcessor |
A metric aggregator that gives the min, max, mean, variance and standard deviation for numeric
metrics collected during multiple-iteration test runs, treating them as doubles.
|
AveragePostProcessor |
Implementation of post processor that calculate the average of the list of metrics.
|
StatsdGenericPostProcessor |
A post processor that processes binary proto statsd reports into key-value pairs by expanding the
report as a tree structure.
|
|
Known indirect subclasses
StatsdEventMetricPostProcessor |
A post processor that processes event metrics in statsd reports into key-value pairs, using the
formatters specified on the processor.
|
|
The base IPostProcessor
that every implementation should extend. Ensure that the post
processing methods are called before the final result reporters.
TODO: expand to file post-processing too if needed.
Summary
Public methods |
final
ITestInvocationListener
|
init(ITestInvocationListener listener)
Initialization step of the post processor.
|
final
void
|
invocationEnded(long elapsedTime)
|
final
void
|
invocationFailed(FailureDescription failure)
|
final
void
|
invocationFailed(Throwable cause)
|
final
void
|
invocationStarted(IInvocationContext context)
Invocation Listeners for forwarding
|
final
boolean
|
isDisabled()
Returns True if entire object disabled (skip both setup and teardown).
|
final
void
|
logAssociation(String dataName, LogFile logFile)
Updates the log-to-test assocation.
|
|
processAllTestMetricsAndLogs(ListMultimap<String, MetricMeasurement.Metric> allTestMetrics, allTestLogs)
Implement this method to aggregate metrics and logs across all tests.
|
abstract
|
processRunMetricsAndLogs( rawMetrics, runLogs)
Implement this method in order to generate a set of new metrics from the existing metrics and
logs.
|
|
processTestMetricsAndLogs(TestDescription testDescription, testMetrics, testLogs)
Implement this method to post process metrics and logs from each test.
|
final
void
|
setLogSaver(ILogSaver logSaver)
|
final
void
|
testAssumptionFailure(TestDescription test, String trace)
|
final
void
|
testAssumptionFailure(TestDescription test, FailureDescription failure)
|
final
void
|
testEnded(TestDescription test, long endTime, testMetrics)
|
final
void
|
testEnded(TestDescription test, testMetrics)
|
final
void
|
testFailed(TestDescription test, FailureDescription failure)
|
final
void
|
testFailed(TestDescription test, String trace)
|
final
void
|
testIgnored(TestDescription test)
|
final
void
|
testLog(String dataName, LogDataType dataType, InputStreamSource dataStream)
|
final
void
|
testLogSaved(String dataName, LogDataType dataType, InputStreamSource dataStream, LogFile logFile)
|
final
void
|
testModuleEnded()
|
final
void
|
testModuleStarted(IInvocationContext moduleContext)
|
final
void
|
testRunEnded(long elapsedTime, runMetrics)
|
final
void
|
testRunFailed(FailureDescription failure)
|
final
void
|
testRunFailed(String errorMessage)
|
final
void
|
testRunStarted(String runName, int testCount, int attemptNumber)
|
final
void
|
testRunStarted(String runName, int testCount)
Test run callbacks
|
final
void
|
testRunStopped(long elapsedTime)
|
final
void
|
testStarted(TestDescription test, long startTime)
|
final
void
|
testStarted(TestDescription test)
Test cases callbacks
|
Protected methods |
MetricMeasurement.DataType
|
getMetricType()
Override this method to change the metric type if needed.
|
Public constructors
BasePostProcessor
public BasePostProcessor ()
Public methods
init
public final ITestInvocationListener init (ITestInvocationListener listener)
Initialization step of the post processor. Ensured to be called before any of the tests
callbacks.
Parameters |
listener |
ITestInvocationListener |
Returns |
ITestInvocationListener |
|
invocationEnded
public final void invocationEnded (long elapsedTime)
Parameters |
elapsedTime |
long |
invocationFailed
public final void invocationFailed (FailureDescription failure)
Parameters |
failure |
FailureDescription |
invocationFailed
public final void invocationFailed (Throwable cause)
Parameters |
cause |
Throwable |
invocationStarted
public final void invocationStarted (IInvocationContext context)
Invocation Listeners for forwarding
Parameters |
context |
IInvocationContext |
isDisabled
public final boolean isDisabled ()
Returns True if entire object disabled (skip both setup and teardown). False otherwise.
logAssociation
public final void logAssociation (String dataName,
LogFile logFile)
Updates the log-to-test assocation. If this method is called during a test, then the log
belongs to the test; otherwise it will be a run log.
Parameters |
dataName |
String |
logFile |
LogFile |
processAllTestMetricsAndLogs
public processAllTestMetricsAndLogs (ListMultimap<String, MetricMeasurement.Metric> allTestMetrics,
allTestLogs)
Implement this method to aggregate metrics and logs across all tests. Metrics coming out of
this method will be reporter as run metrics. Only the newly generated metrics should be
returned, and with unique key name (no collision with existing keys are allowed).
Parameters |
allTestMetrics |
ListMultimap : A HashMultimap storing the metrics from each test grouped by metric
names. |
allTestLogs |
: A map storing each test's map of log files keyed by their data names,
using the each test's TestDescription as keys. |
Returns |
|
The set of newly generated metrics from all test metrics.
|
processRunMetricsAndLogs
public abstract processRunMetricsAndLogs ( rawMetrics,
runLogs)
Implement this method in order to generate a set of new metrics from the existing metrics and
logs. Only the newly generated metrics should be returned, and with unique key name (no
collision with existing keys are allowed).
Parameters |
rawMetrics |
: The set of raw metrics available for the run. |
runLogs |
: The set of log files for the test run. |
Returns |
|
The set of newly generated metrics from the run metrics.
|
processTestMetricsAndLogs
public processTestMetricsAndLogs (TestDescription testDescription,
testMetrics,
testLogs)
Implement this method to post process metrics and logs from each test. Only the newly
generated metrics should be returned, and with unique key name (no collision with existing
keys are allowed).
Parameters |
testDescription |
TestDescription : The TestDescription object describing the test. |
testMetrics |
: The set of metrics from the test. |
testLogs |
: The set of files logged during the test. |
Returns |
|
The set of newly generated metrics from the test metrics.
|
setLogSaver
public final void setLogSaver (ILogSaver logSaver)
Parameters |
logSaver |
ILogSaver |
testAssumptionFailure
public final void testAssumptionFailure (TestDescription test,
String trace)
Parameters |
test |
TestDescription |
trace |
String |
testAssumptionFailure
public final void testAssumptionFailure (TestDescription test,
FailureDescription failure)
Parameters |
test |
TestDescription |
failure |
FailureDescription |
testEnded
public final void testEnded (TestDescription test,
long endTime,
testMetrics)
Parameters |
test |
TestDescription |
endTime |
long |
testMetrics |
|
testEnded
public final void testEnded (TestDescription test,
testMetrics)
Parameters |
test |
TestDescription |
testMetrics |
|
testFailed
public final void testFailed (TestDescription test,
FailureDescription failure)
Parameters |
test |
TestDescription |
failure |
FailureDescription |
testFailed
public final void testFailed (TestDescription test,
String trace)
Parameters |
test |
TestDescription |
trace |
String |
testIgnored
public final void testIgnored (TestDescription test)
Parameters |
test |
TestDescription |
public final void testLog (String dataName,
LogDataType dataType,
InputStreamSource dataStream)
Parameters |
dataName |
String |
dataType |
LogDataType |
dataStream |
InputStreamSource |
public final void testLogSaved (String dataName,
LogDataType dataType,
InputStreamSource dataStream,
LogFile logFile)
Parameters |
dataName |
String |
dataType |
LogDataType |
dataStream |
InputStreamSource |
logFile |
LogFile |
testModuleEnded
public final void testModuleEnded ()
testModuleStarted
public final void testModuleStarted (IInvocationContext moduleContext)
Parameters |
moduleContext |
IInvocationContext |
testRunEnded
public final void testRunEnded (long elapsedTime,
runMetrics)
Parameters |
elapsedTime |
long |
runMetrics |
|
testRunFailed
public final void testRunFailed (FailureDescription failure)
Parameters |
failure |
FailureDescription |
testRunFailed
public final void testRunFailed (String errorMessage)
Parameters |
errorMessage |
String |
testRunStarted
public final void testRunStarted (String runName,
int testCount,
int attemptNumber)
Parameters |
runName |
String |
testCount |
int |
attemptNumber |
int |
testRunStarted
public final void testRunStarted (String runName,
int testCount)
Test run callbacks
Parameters |
runName |
String |
testCount |
int |
testRunStopped
public final void testRunStopped (long elapsedTime)
Parameters |
elapsedTime |
long |
testStarted
public final void testStarted (TestDescription test,
long startTime)
Parameters |
test |
TestDescription |
startTime |
long |
testStarted
public final void testStarted (TestDescription test)
Test cases callbacks
Parameters |
test |
TestDescription |
Protected methods
getMetricType
protected MetricMeasurement.DataType getMetricType ()
Override this method to change the metric type if needed. By default metric is set to
processed type.
Returns |
MetricMeasurement.DataType |
|