IPostProcessor

public interface IPostProcessor
implements IDisableable, ILogSaverListener, ITestInvocationListener

com.android.tradefed.postprocessor.IPostProcessor


Post processors is a Trade Federation object meant to allow the processing of metrics and logs AFTER the tests and BEFORE result reporting. This allows to post-process some data and have all result_reporter objects receive it, rather than doing the post-processing inside only one result_reporter and having issue to pass the new data around.

Summary

Public methods

abstract ITestInvocationListener init(ITestInvocationListener listener)

Initialization step of the post processor.

abstract Map<String, MetricMeasurement.Metric.Builder> processAllTestMetricsAndLogs(ListMultimap<String, MetricMeasurement.Metric> allTestMetrics, Map<TestDescription, Map<String, LogFile>> allTestLogs)

Implement this method to aggregate metrics and logs across all tests.

abstract Map<String, MetricMeasurement.Metric.Builder> processRunMetricsAndLogs(HashMap<String, MetricMeasurement.Metric> rawMetrics, Map<String, LogFile> runLogs)

Implement this method in order to generate a set of new metrics from the existing metrics and logs.

abstract Map<String, MetricMeasurement.Metric.Builder> processTestMetricsAndLogs(TestDescription testDescription, HashMap<String, MetricMeasurement.Metric> testMetrics, Map<String, LogFile> testLogs)

Implement this method to post process metrics and logs from each test.

Public methods

init

public abstract 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

processAllTestMetricsAndLogs

public abstract Map<String, MetricMeasurement.Metric.Builder> processAllTestMetricsAndLogs (ListMultimap<String, MetricMeasurement.Metric> allTestMetrics, 
                Map<TestDescription, Map<String, LogFile>> 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 Map: A map storing each test's map of log files keyed by their data names, using the each test's TestDescription as keys.

Returns
Map<String, MetricMeasurement.Metric.Builder> The set of newly generated metrics from all test metrics.

processRunMetricsAndLogs

public abstract Map<String, MetricMeasurement.Metric.Builder> processRunMetricsAndLogs (HashMap<String, MetricMeasurement.Metric> rawMetrics, 
                Map<String, LogFile> 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 HashMap: The set of raw metrics available for the run.

runLogs Map: The set of log files for the test run.

Returns
Map<String, MetricMeasurement.Metric.Builder> The set of newly generated metrics from the run metrics.

processTestMetricsAndLogs

public abstract Map<String, MetricMeasurement.Metric.Builder> processTestMetricsAndLogs (TestDescription testDescription, 
                HashMap<String, MetricMeasurement.Metric> testMetrics, 
                Map<String, LogFile> 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 HashMap: The set of metrics from the test.

testLogs Map: The set of files logged during the test.

Returns
Map<String, MetricMeasurement.Metric.Builder> The set of newly generated metrics from the test metrics.