TestSummaryLogger


@UnstableApi
class TestSummaryLogger


Utilities for logging test summaries in instrumentation tests.

Summary

Public functions

java-static Unit
recordTestSkipped(context: Context!, testId: String!, reason: String!)

Log in logcat and in an analysis file that this test was skipped.

java-static Unit
writeTestSummaryToFile(
    context: Context!,
    testId: String!,
    testJson: JSONObject!
)

Writes the summary of a test run to the application cache file.

Public functions

recordTestSkipped

java-static fun recordTestSkipped(context: Context!, testId: String!, reason: String!): Unit

Log in logcat and in an analysis file that this test was skipped.

Analysis file is a JSON summarising the test, saved to the application cache.

The analysis json will contain a skipReason key, with the reason for skipping the test case.

writeTestSummaryToFile

java-static fun writeTestSummaryToFile(
    context: Context!,
    testId: String!,
    testJson: JSONObject!
): Unit

Writes the summary of a test run to the application cache file.

The cache filename follows the pattern <testId>-result.txt.

Parameters
context: Context!

The Context.

testId: String!

A unique identifier for the transformer test run.

testJson: JSONObject!

A JSONObject containing a summary of the test run.