This section describes the basics of how to implement a new result reporter and configure it for a test.
In order to define a new result reporter in Tradefed, a class must implement the ITestInvocationListener interface that allows receiving and handling different stages of the invocation:
Result reporters also handle the different stages of each test run:
Given all these events, there are two main types of result reporters, those that:
- Care only about reporting the final complete results.
- Take action on partial results.
Result Reporter that reports final complete results
This type is the most common case when it comes to interacting with an external
service that receives the results. The reporter simply receives and accumulates
the results and then sends them all on
invocationEnded to the result end-point.
It is recommended those reporters extend
of the base interface in order to avoid re-implementing saving and storing the
Result Reporter that reports partial results
This type is usually used for a streaming approach of the results, when results are received and pushed to some other places right away. For example, a reporter that logs the results to the console would be of this type.
This type is specific to which type of handling is required on the events, so implementing the base interface is usually the recommended way.
The object tag will be
result_reporter. For example:
<result_reporter class="com.android.tradefed.result.ConsoleResultReporter"> <option name="suppress-passed-tests" value="true"/> </result_reporter>