# TestSummaryLogger

Artifact: [androidx.media3:media3-test-utils](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/test/utils/TestSummaryLogger.java+class:androidx.media3.test.utils.TestSummaryLogger)

*** ** * ** ***


```
@UnstableApi
public class TestSummaryLogger
```

<br />

*** ** * ** ***

Utilities for logging test summaries in instrumentation tests.

## Summary

| ### Public methods |
|---|---|
| `static void` | `https://developer.android.com/reference/androidx/media3/test/utils/TestSummaryLogger#recordTestSkipped(android.content.Context,java.lang.String,java.lang.String)(https://developer.android.com/reference/android/content/Context.html context, https://developer.android.com/reference/java/lang/String.html testId, https://developer.android.com/reference/java/lang/String.html reason)` Log in logcat and in an analysis file that this test was skipped. |
| `static void` | `https://developer.android.com/reference/androidx/media3/test/utils/TestSummaryLogger#writeTestSummaryToFile(android.content.Context,java.lang.String,org.json.JSONObject)( https://developer.android.com/reference/android/content/Context.html context, https://developer.android.com/reference/java/lang/String.html testId, https://developer.android.com/reference/org/json/JSONObject.html 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.

| Throws |
|---|---|
| `https://developer.android.com/reference/org/json/JSONException.html` |   |
| `https://developer.android.com/reference/java/io/IOException.html` |   |

### 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 |
|---|---|
| `https://developer.android.com/reference/android/content/Context.html context` | The `https://developer.android.com/reference/android/content/Context.html`. |
| `https://developer.android.com/reference/java/lang/String.html testId` | A unique identifier for the transformer test run. |
| `https://developer.android.com/reference/org/json/JSONObject.html testJson` | A `https://developer.android.com/reference/org/json/JSONObject.html` containing a summary of the test run. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/io/IOException.html` |   |
| `https://developer.android.com/reference/org/json/JSONException.html` |   |