src/main/java/com/simpligility/maven/plugins/android/standalonemojos/MonkeyMojo.java
protected void exerciseApp() throws MojoExecutionException, MojoFailureException
    {

        getLog().debug( "Parsed values for Android Monkey invocation: " );
        getLog().debug( "seed:" + parsedSeed );

        DeviceCallback instrumentationTestExecutor = new DeviceCallback()
        {
            @Override
            public void doWithDevice( final IDevice device ) throws MojoExecutionException, MojoFailureException
            {
                String deviceLogLinePrefix = DeviceHelper.getDeviceLogLinePrefix( device );

                MonkeyTestRunner monkeyTestRunner = new MonkeyTestRunner( parsedEventCount, device );

                monkeyTestRunner.setRunName( "ui monkey tests" );
                if ( parsedSeed != null )
                {
                    monkeyTestRunner.setSeed( parsedSeed );
                }
                if ( parsedPercentTouch != null )
                {
                    monkeyTestRunner.setPercentTouch( parsedPercentTouch );
                }
                if ( parsedPercentMotion != null )
                {
                    monkeyTestRunner.setPercentTouch( parsedPercentMotion );
                }
                if ( parsedPercentTrackball != null )
                {
                    monkeyTestRunner.setPercentTrackball( parsedPercentTrackball );
                }
                if ( parsedPercentNav != null )
                {
                    monkeyTestRunner.setPercentNav( parsedPercentNav );
                }
                if ( parsedPercentMajorNav != null )
                {
                    monkeyTestRunner.setPercentMajorNav( parsedPercentMajorNav );
                }
                if ( parsedPercentSyskeys != null )
                {
                    monkeyTestRunner.setPercentSyskeys( parsedPercentSyskeys );
                }
                if ( parsedPercentAppswitch != null )
                {
                    monkeyTestRunner.setPercentAppswitch( parsedPercentAppswitch );
                }
                if ( parsedPercentAnyevent != null )
                {
                    monkeyTestRunner.setPercentAnyEvent( parsedPercentAnyevent );
                }
                if ( parsedPackages != null )
                {
                    monkeyTestRunner.setPackages( parsedPackages );
                }
                if ( parsedCategories != null )
                {
                    monkeyTestRunner.setCategories( parsedCategories );
                }
                monkeyTestRunner.setDebugNoEvents( parsedDebugNoEvents );
                monkeyTestRunner.setHprof( parsedHprof );
                monkeyTestRunner.setIgnoreCrashes( parsedIgnoreCrashes );
                monkeyTestRunner.setIgnoreTimeouts( parsedIgnoreTimeouts );
                monkeyTestRunner.setIgnoreSecurityExceptions( parsedIgnoreSecurityExceptions );
                monkeyTestRunner.setKillProcessAfterError( parsedKillProcessAfterError );
                monkeyTestRunner.setMonitorNativeCrash( parsedMonitorNativeCrashes );

                getLog().info( deviceLogLinePrefix + "Running ui monkey tests" );
                try
                {
                    AndroidTestRunListener testRunListener = new AndroidTestRunListener( device, getLog(),
                            parsedCreateReport, false, "", "", targetDirectory );
                    monkeyTestRunner.run( testRunListener );
                    if ( testRunListener.hasFailuresOrErrors() && !isIgnoreTestFailures() )
                    {
                        throw new MojoFailureException( deviceLogLinePrefix + "Tests failed on device." );
                    }
                    if ( testRunListener.testRunFailed() )
                    {
                        throw new MojoFailureException( deviceLogLinePrefix + "Test run failed to complete: "
                                + testRunListener.getTestRunFailureCause() );
                    }
                    if ( testRunListener.threwException() && !isIgnoreTestFailures() )
                    {
                        throw new MojoFailureException( deviceLogLinePrefix + testRunListener.getExceptionMessages() );
                    }
                }
                catch ( TimeoutException e )
                {
                    throw new MojoExecutionException( deviceLogLinePrefix + "timeout", e );
                }
                catch ( AdbCommandRejectedException e )
                {
                    throw new MojoExecutionException( deviceLogLinePrefix + "adb command rejected", e );
                }
                catch ( ShellCommandUnresponsiveException e )
                {
                    throw new MojoExecutionException( deviceLogLinePrefix + "shell command " + "unresponsive", e );
                }
                catch ( IOException e )
                {
                    throw new MojoExecutionException( deviceLogLinePrefix + "IO problem", e );
                }
            }
        };

        doWithDevices( instrumentationTestExecutor );
    }
protected void exerciseApp() throws MojoExecutionException, MojoFailureException
    {

        getLog().debug( "Parsed values for Android Monkey invocation: " );
        getLog().debug( "seed:" + parsedSeed );

        DeviceCallback instrumentationTestExecutor = new DeviceCallback()
        {
            @Override
            public void doWithDevice( final IDevice device ) throws MojoExecutionException, MojoFailureException
            {
                String deviceLogLinePrefix = DeviceHelper.getDeviceLogLinePrefix( device );

                MonkeyTestRunner monkeyTestRunner = new MonkeyTestRunner( parsedEventCount, device );

                monkeyTestRunner.setRunName( "ui monkey tests" );
                if ( parsedSeed != null )
                {
                    monkeyTestRunner.setSeed( parsedSeed );
                }
                if ( parsedPercentTouch != null )
                {
                    monkeyTestRunner.setPercentTouch( parsedPercentTouch );
                }
                if ( parsedPercentMotion != null )
                {
                    monkeyTestRunner.setPercentTouch( parsedPercentMotion );
                }
                if ( parsedPercentTrackball != null )
                {
                    monkeyTestRunner.setPercentTrackball( parsedPercentTrackball );
                }
                if ( parsedPercentNav != null )
                {
                    monkeyTestRunner.setPercentNav( parsedPercentNav );
                }
                if ( parsedPercentMajorNav != null )
                {
                    monkeyTestRunner.setPercentMajorNav( parsedPercentMajorNav );
                }
                if ( parsedPercentSyskeys != null )
                {
                    monkeyTestRunner.setPercentSyskeys( parsedPercentSyskeys );
                }
                if ( parsedPercentAppswitch != null )
                {
                    monkeyTestRunner.setPercentAppswitch( parsedPercentAppswitch );
                }
                if ( parsedPercentAnyevent != null )
                {
                    monkeyTestRunner.setPercentAnyEvent( parsedPercentAnyevent );
                }
                if ( parsedPackages != null )
                {
                    monkeyTestRunner.setPackages( parsedPackages );
                }
                if ( parsedCategories != null )
                {
                    monkeyTestRunner.setCategories( parsedCategories );
                }
                monkeyTestRunner.setDebugNoEvents( parsedDebugNoEvents );
                monkeyTestRunner.setHprof( parsedHprof );
                monkeyTestRunner.setIgnoreCrashes( parsedIgnoreCrashes );
                monkeyTestRunner.setIgnoreTimeouts( parsedIgnoreTimeouts );
                monkeyTestRunner.setIgnoreSecurityExceptions( parsedIgnoreSecurityExceptions );
                monkeyTestRunner.setKillProcessAfterError( parsedKillProcessAfterError );
                monkeyTestRunner.setMonitorNativeCrash( parsedMonitorNativeCrashes );

                getLog().info( deviceLogLinePrefix + "Running ui monkey tests" );
                try
                {
                    AndroidTestRunListener testRunListener = new AndroidTestRunListener( device, getLog(),
                            parsedCreateReport, false, "", "", targetDirectory );
                    monkeyTestRunner.run( testRunListener );
                    if ( testRunListener.hasFailuresOrErrors() && !isIgnoreTestFailures() )
                    {
                        throw new MojoFailureException( deviceLogLinePrefix + "Tests failed on device." );
                    }
                    if ( testRunListener.testRunFailed() )
                    {
                        throw new MojoFailureException( deviceLogLinePrefix + "Test run failed to complete: "
                                + testRunListener.getTestRunFailureCause() );
                    }
                    if ( testRunListener.threwException() && !isIgnoreTestFailures() )
                    {
                        throw new MojoFailureException( deviceLogLinePrefix + testRunListener.getExceptionMessages() );
                    }
                }
                catch ( TimeoutException e )
                {
                    throw new MojoExecutionException( deviceLogLinePrefix + "timeout", e );
                }
                catch ( AdbCommandRejectedException e )
                {
                    throw new MojoExecutionException( deviceLogLinePrefix + "adb command rejected", e );
                }
                catch ( ShellCommandUnresponsiveException e )
                {
                    throw new MojoExecutionException( deviceLogLinePrefix + "shell command " + "unresponsive", e );
                }
                catch ( IOException e )
                {
                    throw new MojoExecutionException( deviceLogLinePrefix + "IO problem", e );
                }
            }
        };

        doWithDevices( instrumentationTestExecutor );
    }
Actually plays tests.

@throws MojoExecutionException
if exercising app threw an exception and isIgnoreTestFailures is false..
@throws MojoFailureException
if exercising app failed and isIgnoreTestFailures is false.