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() 可傳回 ITargetPreparer 的清單 包含 PreloadedClassesPreparer 的例項。
  • IConfiguration#getTests() 傳回包含 HostTest 例項的 IRemoteTest 清單。

設定物件中的每個物件都可以對應至 XML 定義,因此瞭解 XML 定義通常有助於瞭解設定物件應有的樣貌。