TestSummaryLogger


@UnstableApi
public class TestSummaryLogger


Utilities for logging test summaries in instrumentation tests.

Summary

Public methods

static void
recordTestSkipped(Context context, String testId, String reason)

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

static void
writeTestSummaryToFile(
    Context context,
    String testId,
    JSONObject testJson
)

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

Public methods

recordTestSkipped

public static void recordTestSkipped(Context context, String testId, String reason)

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

public static void writeTestSummaryToFile(
    Context context,
    String testId,
    JSONObject testJson
)

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.

String testId

A unique identifier for the transformer test run.

JSONObject testJson

A JSONObject containing a summary of the test run.