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 can I add my service into remote app and start it which I injected by Xposed?
Android : Receiving file from dropbox application but File not found exception
How to add click event to item on NavigationView of Android
Animation alpha (under SurfaceView) not working
Sample Google Maps is not working
How to polyline on google map in android app by using onLocationChange()? [duplicate]
Unable to resolve host “exemple.ma”: No address associated with hostname i have the url of wsdl and internet permission [closed]
Android SDK 6.0.2: Could not ifind installed version of Gradle (Ioni2)
Appcelerator Android Facebook Login Problems
Android: Zoomout / Zoomin animations on button press/release in android
Checking if field data changed rather than any field in child data
Android-webview not loading htmlcontent with webview.loaddata()
Firebase: HTTP POSTing Notification from Android App returns success but nothing happens
android Method setOnPreparedListener must be called from the UI thread, currently inferred thread is worker
android.os.NetworkOnMainThreadException when using RxJava2 zip operator [duplicate]
Unable to determine the workspace. You may be able to correct this by running

Categories

HOME
cygwin
phantom-dsl
phpword
google-cloud-platform
oracle12c
api
jpa
fuelux
gpu
jmx
jelastic
sitecore
devise
gradient
nuget
bitbucket-api
carousel
regular-language
jax-ws
computer-science
distribution
ycsb
openbugs
tput
eip
flash-player
forgot-password
swagger-2.0
replication
asciidoctor-pdf
visual-glitch
cgbitmapcontext
easeljs
mongoid6
monit
asymptotic-complexity
ms-access-2003
openmdao
cppreference
google-earth
left-join
papaparse
jett
protege4
alphabetical
watchman
protein-database
demo
setup.py
xv6
android-softkeyboard
movilizer
claims
xmldocument
vaadin-charts
stylecop
pom.xml
tf
qtranslate
headless
objectscript
docpad
simplepie
respondcms
freepbx
cfchart
gcloud-ruby
aspen
np-spring
rasterize
decimalformat
lazybones
jdk1.7
typemock
wso2greg
keyup
gamekit
code-documentation
encryption-asymmetric
mobility
codeplex
drupal-nodes
android-audiorecord
gwt-openlayers
http-patch
c++builder-xe5
windows-phone-8-sdk
mvc-editor-templates
node-blade
traceability
server-administration
cardreader
android-sdk-2.3
adobe-media-server
appjs
fitbounds
agility.js
catransform3d
msr
presentation-layer
object-database
office-2007
folding
isapi-extension
sifr
filesystemobject
dsl-tools
linfu-dynamicproxy
lemmatization
contentpresenter
movieplayer
idatareader

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App