protected String extractInstrumentationRunnerFromAndroidManifest ( File manifestFile ) throws MojoExecutionException { final URL xmlURL ; try { xmlURL = manifestFile . toURI ( ) . toURL ( ) ; } catch ( MalformedURLException e ) { throw new MojoExecutionException ( "Error while trying to figure out instrumentation runner from inside AndroidManifest.xml file " + manifestFile , e ) ; } final DocumentContainer documentContainer = new DocumentContainer ( xmlURL ) ; final Object instrumentationRunner ; try { instrumentationRunner = JXPathContext . newContext ( documentContainer ) . getValue ( "manifest//instrumentation/@android:name" , String . class ) ; } catch ( JXPathNotFoundException e ) { return null ; } return ( String ) instrumentationRunner ; }
Attempts to find the instrumentation test runner from inside the AndroidManifest . xml file .