系统将解析 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()返回包含HostTest实例的IRemoteTest的列表。
配置对象中的每个对象均可映射到 XML 定义,因此理解 XML 定义通常有助于理解配置对象会返回什么内容。