Starting March 27, 2025, we recommend using android-latest-release
instead of aosp-main
to build and contribute to AOSP. For more information, see Changes to AOSP.
Stay organized with collections
Save and categorize content based on your preferences.
ScreenshotOnFailureCollector
public
class
ScreenshotOnFailureCollector
extends BaseDeviceMetricCollector
Collector that will capture and log a screenshot when a test case fails.
Summary
Public constructors
ScreenshotOnFailureCollector
public ScreenshotOnFailureCollector ()
Public methods
onTestRunStart
public void onTestRunStart (DeviceMetricData runData)
Callback when a test run is started.
Parameters |
runData |
DeviceMetricData : the DeviceMetricData holding the data for the run. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2023-03-08 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-03-08 UTC."],[],[],null,["# ScreenshotOnFailureCollector\n============================\n\n\n`\npublic\n\n\nclass\nScreenshotOnFailureCollector\n`\n\n\n`\n\n\n`\n\n`\n\nextends `[BaseDeviceMetricCollector](../../../../../../../reference/tradefed/com/android/tradefed/device/metric/BaseDeviceMetricCollector.html)`\n\n\n`\n\n`\n\n\n`\n\n|---|---|-----------------------------------------------------------------|\n| java.lang.Object |||\n| ↳ | [com.android.tradefed.device.metric.BaseDeviceMetricCollector](../../../../../../../reference/tradefed/com/android/tradefed/device/metric/BaseDeviceMetricCollector.html) ||\n| | ↳ | com.android.tradefed.device.metric.ScreenshotOnFailureCollector |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nCollector that will capture and log a screenshot when a test case fails.\n\nSummary\n-------\n\n| ### Public constructors ||\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| ` `[ScreenshotOnFailureCollector](../../../../../../../reference/tradefed/com/android/tradefed/device/metric/ScreenshotOnFailureCollector.html#ScreenshotOnFailureCollector())`() ` |\n\n| ### Public methods ||\n|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` void` | ` `[onTestFail](../../../../../../../reference/tradefed/com/android/tradefed/device/metric/ScreenshotOnFailureCollector.html#onTestFail(com.android.tradefed.device.metric.DeviceMetricData,%20com.android.tradefed.result.TestDescription))`(`[DeviceMetricData](../../../../../../../reference/tradefed/com/android/tradefed/device/metric/DeviceMetricData.html)` testData, `[TestDescription](../../../../../../../reference/tradefed/com/android/tradefed/result/TestDescription.html)` test) ` Callback when a test case fails. |\n| ` void` | ` `[onTestRunStart](../../../../../../../reference/tradefed/com/android/tradefed/device/metric/ScreenshotOnFailureCollector.html#onTestRunStart(com.android.tradefed.device.metric.DeviceMetricData))`(`[DeviceMetricData](../../../../../../../reference/tradefed/com/android/tradefed/device/metric/DeviceMetricData.html)` runData) ` Callback when a test run is started. |\n\nPublic constructors\n-------------------\n\n### ScreenshotOnFailureCollector\n\n```\npublic ScreenshotOnFailureCollector ()\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nPublic methods\n--------------\n\n### onTestFail\n\n```\npublic void onTestFail (DeviceMetricData testData, \n TestDescription test)\n```\n\nCallback when a test case fails.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `testData` | `DeviceMetricData`: the [DeviceMetricData](../../../../../../../reference/tradefed/com/android/tradefed/device/metric/DeviceMetricData.html) holding the data for the test case. \u003cbr /\u003e |\n| `test` | `TestDescription`: the [TestDescription](../../../../../../../reference/tradefed/com/android/tradefed/result/TestDescription.html) of the test case in progress. \u003cbr /\u003e |\n\n| Throws ||\n|-------------------------------------------------------------------------------------------------------------------------------------|---|\n| [DeviceNotAvailableException](../../../../../../../reference/tradefed/com/android/tradefed/device/DeviceNotAvailableException.html) | |\n\n### onTestRunStart\n\n```\npublic void onTestRunStart (DeviceMetricData runData)\n```\n\nCallback when a test run is started.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `runData` | `DeviceMetricData`: the [DeviceMetricData](../../../../../../../reference/tradefed/com/android/tradefed/device/metric/DeviceMetricData.html) holding the data for the run. \u003cbr /\u003e |"]]