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

BOOT_COMPLETED is not getting called in device
Android: ListView child duplicates data
Android - get application account outside SyncAdapter (handle sync options)
Why is not center this layout?
Can't get EditText to get focus and popup keyboard
I'm not getting all the points on MotionEvent.ACTION_MOVE
I need a sdk apk path when click on apk
Using Django User object in Android
How do I get the album art of the song currently playing
Android MediaPlayer persistent cache using ExoPlayer
Limit number of checkboxes in Android Preferences
Bluetooth on activity Result
showing and hiding layouts from Toolbar in Xamarin Android
Flipping openGL texture from Bytebuffer before creating the Bitmap in Android
Values are not getting displayed in listview using getter setter class
Not able to change text of textview while sending intent from another Activity

Categories

HOME
microsoftgraph
deep-learning
mjml
battery
obfuscation
saml-2.0
tivoli
jetty
spring-session
data-visualization
jax-ws
project
categorical-data
gson
plist
startup
stellar.js
pybossa
android-intent
cumulocity
entitymanager
sencha-touch
boost-icl
google-maps-autocomplete
parcelable
android-maps
wcag
iis-express
livelink
hibernate-validator
papaparse
sharding
servicestack-text
apic
alphabetical
timing
demo
setup.py
apriori
microsoft-metro
outputcache
xmldocument
photos
opencmis
plan-9
jide
openrasta
spring-integration-sftp
bluez
amq
video-conferencing
opengl-4
excel-dna
libjpeg
lsyncd
vibrate
django-1.10
rmongo
choice
gets
cronexpression
ziparchive
preprocessor
dotnetnuke-7
mongodb-php
expectations
eigenvector
stream-processing
lua-telegram-bot
jnlua
concurrentmodification
linklabel
fiware-monitoring
vacuum
dronekit-android
graphics2d
teamcity-9.1
nodelist
at-job
android-cookiemanager
gii
parallel-testing
maven-scm
conditionaltagsupport
git-repo
ecslidingviewcontroller
virtual-pc
tree-balancing
paginator
matlab-load
android-holo-everywhere
uipagecontrol
non-clustered-index
glui
complex-event-processing
cldc
sifr3
fail-fast-fail-early

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