private RemoteAndroidTestRunner createConfiguredRunner ( String testPackage , String testRunner , IDevice device ) throws Exception { RemoteAndroidTestRunner runner = new SpoonAndroidTestRunner ( instrumentationInfo . getApplicationPackage ( ) , testPackage , testRunner , device , clearAppDataBeforeEachTest , debug ) ; runner . setMaxTimeToOutputResponse ( adbTimeout . toMillis ( ) , TimeUnit . MILLISECONDS ) ; for ( Map . Entry < String , String > entry : instrumentationArgs . entrySet ( ) ) { if ( isNullOrEmpty ( entry . getKey ( ) ) || isNullOrEmpty ( entry . getValue ( ) ) ) { // Invalid values, skipping logDebug ( debug , "Can't process instrumentationArg [%s] (empty key or value)" , entry . getKey ( ) + "=>" + entry . getValue ( ) ) ; continue ; } runner . addInstrumentationArg ( entry . getKey ( ) , entry . getValue ( ) ) ; } if ( numShards != 0 ) { addShardingInstrumentationArgs ( runner ) ; } if ( ! isNullOrEmpty ( className ) ) { if ( isNullOrEmpty ( methodName ) ) { runner . setClassName ( className ) ; } else { runner . setMethodName ( className , methodName ) ; } } if ( testSize != null ) { runner . setTestSize ( testSize ) ; } if ( codeCoverage ) { addCodeCoverageInstrumentationArgs ( runner , device ) ; } return runner ; }
Create a configured Test Runner . This method adds sharding class name method name test size and coverage if available .