Run Trade Federation with specific device

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Run Trade Federation with specific device

Kuanlin Chen
According to https://source.android.com/devices/tech/test_infra/tradefed/full_example#runconfig

My question is how to specify one device while running tradefed ?

I wrote a sample class like this, but I have no idea how to use setDevice().
public class HelloWorld implements IRemoteTest, IDeviceTest {

   
@Option(name = "device", description = "Run with specific device", importance=Option.Importance.ALWAYS)
   
private String serialNumber = "test";
   
   
private ITestDevice mDevice;

   
@Override
   
public void setDevice(ITestDevice device) {
        mDevice
= device;
   
}

   
@Override
   
public ITestDevice getDevice() {
       
return mDevice;
   
}

   
@Override
   
public void run(ITestInvocationListener listener) throws DeviceNotAvailableException {
       
if(!serialNumber.equals("test")){
            setDevice
((ITestDevice)serialNumber);  // <== How to convert String to ITestDevice ?
       
}
       
LogUtil.CLog.i("Hello, TF World! I have device %s", getDevice().getSerialNumber());
   
}
}


--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/android-platform.
For more options, visit https://groups.google.com/d/optout.