In order to understand this section, first study the Tradefed @Option.
Typical options in Tradefed allow for test classes to receive additional information from the XML configuration or command line. This feature allows you to go one extra step and resolve some of this additional information if necessary.
File option example
Example File @option:
@Option(name = 'config-file') private File mConfigFile;
The above can be set via XML configuration:
<option name="config-file" value="/tmp/file" />
or via command:
The feature allows you to resolve File-typed @Options that are remote into a local file to be available seamlessly from a user standpoint.
For this to work, the file needs to be specified with a remote style path. For example:
This path points to a file within a Google Cloud Storage (GCS) bucket where
it's stored. Tradefed upon seeing that remote path, will attempt to download the
file locally and assign it to the @Option. This results in the
variable to now point to the local version of the file, which can be used by
If the remote file cannot be downloaded for any reason, Tradefed will throw
ConfigurationException that will prevent the test from running. We consider
missing those files a critical failure since some test artifacts will also be
The officially supported protocol to download and its format are:
Google Cloud Storage, protocol:
The dynamic resolution of @Option currently supports only a limited number of
protocols and locations to download from. The resolution of @Option is currently
enabled only for the main XML Tradefed configuration. If running as a suite, current
AndroidTest.xml) will not resolve the files. This is meant to prevent
modules from creating some unknown dependencies.
Implementing a new protocol
The protocols that are supported have an implementation in Tradefed of the
which defines the short tag of the protocol that will be matched in the
file path. For example,
gs is used for the Google Cloud Storage protocol.
The protocols implemented can be added to DynamicRemoteFileResolver maps to officially turn on the support.