Similar to Target Preparer, multi-target preparer allows setup of multiple devices together. For example, this would be used when connecting two devices via Bluetooth for testing.
The base interface is
which allows implementing a
setUp method that will be executed. We recommend
implementing our basic abstract class
which provides a built-in disablement feature to easily disable a preparer.
Multi-target preparers also directly provide a
tearDown method for any cleanup
We recommend each preparer be limited to a single main function. This allows for easier re-use of preparers.
You should also check the list of available preparers before adding a new one to avoid duplicating work. Preparers are available in:
There is no limit to the number of devices that a multi-target preparer can
set up. All the devices are available in the
IInvocationContext of the
interface to implement.
The object tag will be
multi_target_preparer, for example:
<multi_target_preparer class="com.android.tradefed.targetprep.multi.HelloWorldMultiTargetPreparer"> </multi_target_preparer>
tearDownbefore target cleaners
This does not always allow performance of all setup steps, so it is possible in
theXML to define the multi-target preparer as
execute it before
<multi_pre_target_preparer class="com.android.tradefed.targetprep.multi.HelloWorldMultiTargetPreparer"> </multi_pre_target_preparer>
The overall operation order is as followed:
- multi_pre_target_preparer(s) setUp
- target_preparer(s) setUp
- multi_target_preparer(s) setUp
- multi_target_preparer(s) tearDown
- target_preparer(s) tearDown
- multi_pre_target_preparer(s) tearDown
Any multi-target preparer can be declared as
multi_pre_target_preparer depending of what order of setup is required.