PlatformTestStorageRegistry


class PlatformTestStorageRegistry


A registry instance that holds a reference to an PlatformTestStorage instance.

Users should use this to retrieve the appropriate PlatformTestStorage for the current execution environment.

Summary

Public functions

synchronized java-static PlatformTestStorage!

Returns the registered PlatformTestStorage instance.

synchronized java-static Unit

Registers a new PlatformTestStorage instance.

Public functions

getInstance

synchronized java-static fun getInstance(): PlatformTestStorage!

Returns the registered PlatformTestStorage instance.

By default, a FileTestStorage implementation is used. The default implementation is currently recommended for users using android gradle plugins version 8.0 or greater which supports writing output files (only). Gradle users using versions 8.0 or greater can optionally also opt in the test services TestStorage implementation by adding the following configuration to their build.gradle file: defaultConfig { testInstrumentationRunnerArguments useTestStorageService: "true" } dependencies { androidTestUtil "androidx.test.services:test-services:$servicesVersion" }

This method returns the instance last registered by the registerInstance method, or the default instance if none is ever registered. Advanced users can provide java.util.ServiceLoader metadata to provide an alternate implementation to load.

registerInstance

synchronized java-static fun registerInstance(instance: PlatformTestStorage!): Unit

Registers a new PlatformTestStorage instance. This will override any previously set instance.

Users should not typically call this directly - it is intended for use by the test infrastructure.

Parameters
instance: PlatformTestStorage!

the instance to be registered. Cannot be null.