Tradefed 配置对象

解析Tradefed XML 配置,并从中创建一个描述完整配置的Configuration对象。

该对象由IConfiguration 接口描述。它将包含 XML 中定义的所有对象的实例。

这个例子:

<configuration description="<description of the configuration>">
    <!-- A build provider that takes local device information -->
    <build_provider class="com.android.tradefed.build.BootstrapBuildProvider" />

    <!-- Some target preparation, disabled by default -->
    <target_preparer class="com.android.tradefed.targetprep.PreloadedClassesPreparer">
        <option name="disable" value="true" />
    </target_preparer>

    <!-- One test running some unit tests -->
    <test class="com.android.tradefed.testtype.HostTest">
        <option name="class" value="com.android.tradefed.build.BuildInfoTest" />
    </test>
</configuration>

将导致:

  • IConfiguration#getBuildProvider()返回一个BootstrapBuildProvider实例。
  • IConfiguration#getTargetPreparers()返回包含PreloadedClassesPreparer实例的ITargetPreparer列表。
  • IConfiguration#getTests()返回包含IRemoteTest实例的HostTest

配置对象中的每一个对象都可以映射到 XML 定义,因此理解 XML 定义通常有助于理解对配置对象的期望。