FileDocCategorySizeDatePackage
AndroidJUnitLaunchAction.javaAPI DocAndroid 1.5 API9298Wed May 06 22:41:10 BST 2009com.android.ide.eclipse.adt.launch.junit

AndroidJUnitLaunchAction

public class AndroidJUnitLaunchAction extends Object implements com.android.ide.eclipse.adt.launch.IAndroidLaunchAction
A launch action that executes a instrumentation test run on an Android device.

Fields Summary
private final com.android.ide.eclipse.adt.launch.junit.runtime.AndroidJUnitLaunchInfo
mLaunchInfo
Constructors Summary
public AndroidJUnitLaunchAction(com.android.ide.eclipse.adt.launch.junit.runtime.AndroidJUnitLaunchInfo launchInfo)
Creates a AndroidJUnitLaunchAction.

param
launchInfo the {@link AndroidJUnitLaunchInfo} for the JUnit run

        mLaunchInfo = launchInfo;
    
Methods Summary
public booleandoLaunchAction(com.android.ide.eclipse.adt.launch.DelayedLaunchInfo info, com.android.ddmlib.IDevice device)
Launch a instrumentation test run on given Android device. Reuses JDT JUnit launch delegate so results can be communicated back to JDT JUnit UI.

see
IAndroidLaunchAction#doLaunchAction(DelayedLaunchInfo, IDevice)

        String msg = String.format("Launching instrumentation %s on device %s",
                mLaunchInfo.getRunner(), device.getSerialNumber());
        AdtPlugin.printToConsole(info.getProject(), msg);
        
        try {
           mLaunchInfo.setDebugMode(info.isDebugMode());
           mLaunchInfo.setDevice(info.getDevice());
           JUnitLaunchDelegate junitDelegate = new JUnitLaunchDelegate(mLaunchInfo);
           final String mode = info.isDebugMode() ? ILaunchManager.DEBUG_MODE : 
               ILaunchManager.RUN_MODE; 

           junitDelegate.launch(info.getLaunch().getLaunchConfiguration(), mode, info.getLaunch(),
                   info.getMonitor());

           // TODO: need to add AMReceiver-type functionality somewhere
        } catch (CoreException e) {
            AdtPlugin.printErrorToConsole(info.getProject(), "Failed to launch test");
        }
        return true;
    
public java.lang.StringgetLaunchDescription()
{@inheritDoc}

        return String.format("%s JUnit launch", mLaunchInfo.getRunner());