android


Added JUnit, but Android Studio wants me to add testng


Referring to https://developer.android.com/training/testing/unit-testing/local-unit-tests.html and https://medium.com/#ali.muzaffar/the-basics-of-unit-and-instrumentation-testing-on-android-7f3790e77bd, I added
testCompile 'junit:junit:4.12'
in my gradle. Then I created a new test class, but apparently
#Test
throws 'Cannot resolve symbol'. On pressing ALT + Enter, Android Studio suggested me to 'Add testng to classpath'.
I don't quite understand what's going on here. I thought I don't need testng for what I'm trying to do here, nor the 2 articles above also didn't mention anything about testng.
Furthermore if I followed the Android Studio suggestion to 'Add testng to classpath', Android Studio will automatically add
androidTestCompile 'org.testng:testng:6.9.6'
in my gradle. And when I try to run the test, I will get the error
Error:Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define Lorg/hamcrest/Description;
Apparently changing
testCompile 'junit:junit:4.12'
to
androidTestCompile 'junit:junit:4.12'
solves this. Android Studio also won't bug me to add testng to classpath.
This Confused about testCompile and androidTestCompile in Android Gradle also helped me to understand more about testCompile vs androidTestCompile

Related Links

How do you save shared preferences in a sql database?
Android Studio Library reference ..\OpenCV-2.4.6-android-sdk\sdk\java could not be found
linphone - error when build: undefined reference
Finish Activity via Home Button while AlertDialog.Builder is active
Grade Error parsing XML: prefix must not be bound to one of the reserved namespace names
Android, Files are not displayed when arrives to my created external folder
Spacing Button in android
Why the file manager App didn't work when using Intent.ACTION_PICK in Android?
Android: Is it possible to share a GoogleApiClient between activities and services?
ImageView in listview adapter only resizes correctly if I scroll down and scroll back up?
Recyclerview items get reset on scrolling
Alarm Repeats Infinitely — Locking up phone
Android AutoCompleteTextView with Geocoder
addAccountExplicitly Success, but not showing any account in Settings/Account
Bad data interpretation when scrolling of Listview
Connect Android Studio to device via LAN

Categories

HOME
phpword
google-cloud-platform
gridview
fuelux
developer-tools
github-for-windows
ecmascript-6
datastore
depth
swt
apache-spark-mllib
access
odoo-8
nstableheaderview
g++
fhir
line
ipmitool
selenium-ide
mongodb-csharp
parameter-passing
mathprog
forgot-password
springfox
libigl
href
jboss6.x
xcode-ui-testing
licensing
fragment-backstack
outliers
subclass
comparable
sqsh
ntp
cognos-bi
jbutton
quickfixj
r-grid
jett
getpixel
carriage-return
modalviewcontroller
git-rewrite-history
flatmap
amazon-ses
bc
google-data-api
setup.py
comparison-operators
xv6
movilizer
sharp-snmp
file-sharing
optimizely
cnc
user-defined-fields
dbcontext
dtsearch
geotiff
avx
er-diagram
quicktime
cronexpression
docpad
microstation
model-associations
vorpal.js
freepbx
kango-framework
qbxml
terracotta
fiware-monitoring
microsoft-reporting
android-launcher
binomial-theorem
text-search
dronekit-android
git-ftp
mraid
uvc
procedural-programming
primitive-types
entry-point
decoupling
synapse
kendo-dataviz
process-explorer
time.h
cascadingdropdown
resource-management
robotlegs
sentestingkit
web-farm
objectquery
mapping-by-code
usertype
jquery-tools
entitydatasource
facebook-iframe
application-verifier
perl5.12

Resources

Encrypt Message