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 to find similar object in two different images in android
GCM push notification is not received if app was not opened in a long time
Need guidance regarding using FCM to communicate between devices
Very specific issue about reduce latency between 2 photo first with flash and second without
how to pass user input from activityOne to activityThree, activityFour, activityFive in Android?
Android: Keeping the soft keyboard open even on clicking the done button
android ANR in enqueueMessage
SQLiteException: Can't upgrade read-only database from version 0 to 1
Google location client optimizing inaccurate / wrong location updates
The Values not updated in textview when i landed second time in Activity B
Referring Android vector resource in Xamarin - PCL?
onCreate() method of SQLiteOpenHelper is not called neither in onUpgrade nor using getReadableDatabase() [duplicate]
ZXing Xamarin Android Full Of Errors
create an overlay app to detect screen
How to play a YouTube Video in Intel XDK
Android printAdapter crashes when pressing print before preview is finished rendering

Categories

HOME
android
uml
twitter-bootstrap-3
checkstyle
merge
interface
components
jsf-2.2
owl-carousel
access
permissions
polling
jtextpane
angularfire2
frontend
okhttp
package.json
aws-sdk
joptionpane
easeljs
event-store
licensing
shared
inversion-of-control
user-defined-functions
failover
weather
sql-server-2000
cart
quickfixj
fstream
dsx-desktop
hreflang
sammy.js
contacts
arduino-ide
sql-delete
yowsup
lubridate
latitude-longitude
nohup
connection-pool
comparison-operators
dbnull
oracle-service-bus
importerror
stylecop
bluez
css-transforms
pybrain
vibrate
shinobi
vcloud-director-rest-api
materialized-path-pattern
latin
centrifuge
spring-cloud-feign
rspec2
google-query-language
lz77
cortex-m
blitline
contentcontrol
jaunt-api
dynatree
atoi
botan
alloy-ui
snoop
phpldapadmin
infosphere-spl
jbake
addressing-mode
webfinger
ray
draw2d-js
rfc5322
ora-06550
cffile
observium
mvc-editor-templates
insert-id
twisted.web
alice
monotouch.dialog
apache-whirr
kqueue
convention
role
landscape-portrait
photolibrary
silent
pagemethods
glui
wordprocessingml
windows-identity
firefox-3
blind

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile