android


AndroidManifest.xml and tests in Android Studio


I have a basic Android project with an application sources directory and tests sources directory set up by the Android Project template.
I have read that Android tests uses an Androidmanifest.xml specific to the running tests in which we have to specify the instrumentation type and the target package:
<instrumentation
android:name="android.test.InstrumentationTestRunner"
android:targetPackage="com.mypackage.app" />
In Android Studio,I can run tests with android tests configuration without specifiying an AndroidManifest.xml file specific to my tests (there is no AndroidManifest.xml file in my tests sources).
When I run tests in Android Studio I can see that my app is deployed before tests are running and then my tests are launched. Therefore, I guessed that Android Studio himself manage the test process and the generation of the AndroidManifest.xml specific to the tests.
Am I correct ?
According to the docs for the Android Gradle plugin (http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Testing), when describing how to set up source sets for Android tests:
The sourceSet should not contain an AndroidManifest.xml as it is automatically generated.
You can configure parameters for the test such as the InstrumentationTestRunner directly fro the build file like so:
android {
defaultConfig {
testPackageName "com.test.foo"
testInstrumentationRunner "android.test.InstrumentationTestRunner"
testHandleProfiling true
testFunctionalTest true
}
}
Because Android Gradle plugin update, on the basis of Scott Barta's answer, now you maybe write like this:
android {
defaultConfig {
testApplicationId "com.test.foo"
testInstrumentationRunner "android.test.InstrumentationTestRunner"
testHandleProfiling true
testFunctionalTest true
}
}

Related Links

Android : Pressing the button for the second time does not work again and showed a black screen
Using the right authentication option on App Engine for integrating with Google sign in api
parse deployment on heroku and using android
How to create custom row in Listview for only selected rows?
Get active facebook access token in android
How to debug instrumentation tests in Android Studio?
Moving forward one by one in arraylist till the end, on button press using fragment?
android app after login how can i build user profile page in java?
OnItemClickListener doesn't work , OnItemClick is not called
Using JSON and creating markers for Android Maps API load time
Money transfer via Android/iOS app using credit cards
Android studio instrumented apk error while running application
Is my device not support appCompatActivity?
Is it possible to recreate a new android keystore using my old keysotre details?
When not to use ViewHolder pattern?
Canvas drawing with Android

Categories

HOME
embedded
google-cloud-platform
facebook-oauth
cobalt
jmeter
redux-form
google-spreadsheet
battery
jelastic
solver
owl-carousel
replace
javacc
static-site
rom
visual-studio-emulator
interpolation
mvc5
pkcs#11
bing-maps
vimdiff
resultset
onedrive-api
jersey-1.0
user-experience
libigl
systemtime
qliksense
onload
custom-post-type
bulletphysics
jasmine-node
8051
inversion-of-control
datastax-enterprise-graph
tizen-tv
ntp
r-grid
gojs
twos-complement
amazon-ses
jvmti
news
sharp-snmp
vaadin-charts
dapper-simplecrud
monkey-testing
httrack
openrasta
qtranslate
java-6
edit
mathcad
pocketsphinx-android
smartfoxserver
node-request
redbeard-ios
latin
iotivity
synonym
cassia
fuzzywuzzy
qt5.2
poppler
dronekit-android
pyobjc
dnssec
aspectj-maven-plugin
rrule
qtwebengine
ejb-2.x
ora-00904
lnk
spring-remoting
websphere-esb
spring-3
observium
mantle
alice
boost-msm
wcf-configuration
pyunit
kqueue
isa-swizzling
virtualpathprovider
luabind
workflow-services
winmain
jqote
objective-j
load-time
ajax-polling
complex-event-processing
localizable.strings
firefox-3
technical-debt
lemmatization
xslcompiledtransform

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App