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

Android reading from local.properties
Jenkins trying to launch Android AVD Timed-out after waiting 720 seconds for emulator
Show Layout from behind another layout with animation
HttpUrlConnection fetched different content from website content
How do i increase the value of a textview with a handler? (or other solution)
Not getting notifications on drag gestures on screen
Proguard Files for Library project and Application Project
Crossed QS Tiles on Android N
I want to know how apps made for websites works, i.e. a website that is embedded in the app and not just a webview?
Android GeoFire onKeyEntered not trigged
Error when trying to access Cursor data
Android ListView is not selecting rows
Android ActionMode doesnt work on all android versions
Recyclerview not clickable
Ionic - Obfuscated app not running on the phone, why?
Android MediaCodec decoder ,carry custom info with input video frames

Categories

HOME
design-patterns
polymer
codenvy
ggplot2
nvd3.js
zend-framework
rsa
nuget
xbee
boto3
teechart
fosrestbundle
enthought
github-enterprise
automatic-ref-counting
code-generation
frequency-distribution
searchview
job-scheduling
imessage
bourbon
charles
spring-async
joptionpane
event-store
exploit
direct3d11
dapper-extensions
siri
slidetoggle
motion-detection
licensing
dotspatial
fstream
dynamic-jasper
latitude-longitude
magento-1.9.2.4
zoomify
nohup
amazon-ses
z-notation
password-protection
xv6
android-checkbox
show-hide
monkey-testing
optimizely
configurationmanager
tf
myspace
greatest-n-per-group
neon
ng-grid
jtwig
cassia
phpgrid
java-money
wiredep
zscript
uncompress
user-permissions
fits
xmltype
iiop
iso-prolog
lambda-architecture
gae-quotas
synapse
android-audiorecord
syndicationfeed
gd-graph
ice-cube
mongohq
jquery-1.9
virtual-pc
frameworkelementfactory
patricia-trie
listitem
thttpd
jquery-address
urlrewriter
rmdir
event-receiver
diagrams
web-application-project
mathematical-notation
dojo-dnd
soappy

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile