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

Inserting data in common fileds of layout with multiple entries in same activity
How can i open an application/download it from play store while click a link from a message [closed]
GcmBroadcastReceiver receiving message twice
Making In-App Payments in Mobile Apps
View.getContext() returns null after constructor View(context) in a JUnit test
scrollView not scrolling until end
Android studio NumberFormatException: Invalid revision: 24.0.0-alpha1: Invalid revision: 24.0.0-alpha1 error
Notifications for google drive upload
How to maintain view instances created in onCreateView of Fragment in ViewPager when Resuming the fragment?
Customise calendar for both iOS and Android
Datepickerdialog don't open when its empty
Android Webview: Having separate(temporary) cookies for private mode
WHERE equivalent for Firebase Realtime Database in Android [duplicate]
I want to create this UI in android
Google Fit sleep returning extremely low values
Why did modifying the WebView Layout Parameter fix the 0 height body issue?

Categories

HOME
service-worker
github-for-windows
components
package
rendering
yandex
limit
babeljs
maxscript
tvos
crystal-reports-2013
teechart
little-proxy
fhir
mel
gson
windows-ce
line
naivebayes
eip
magnetic-cards
mapstruct
pimcore
interpreter
pic32
fragment-backstack
delimiter
nstimer
oculus
handler
browser-sync
testcomplete
scatter3d
cognos-bi
card.io
biztalk-rule-engine
nested-lists
html-encode
baidu-map
sql-server-ce
gdata
verifiable-c
mongoose-schema
comparison-operators
outputcache
uiimage
snapchat
phpdbg
opennms
chai-as-promised
configurationmanager
datamaps
insight
carrot2
yii2-user
sundials
seek
burrows-wheeler-transform
synonym
gogs
udpclient
respondcms
nservicebus5
bizagi
phpwebsocket
asyncdisplaykit
boomerang
iokit
xenomai
typemock
google-refine
umlgraph
bcache
infosphere-spl
uncaught-typeerror
structuremap3
entry-point
strawberry-perl
angular-carousel
qscrollarea
conditionaltagsupport
gwt-openlayers
spring-3
mt4j
visual-studio-express
cmmi
font-awesome-4.0.0
insert-id
boost-msm
azman
wiimote
virtualpathprovider
htdocs
jqote
tournament
pylucene
jqueryform
addchild
zen
tabpanel
blender-2.49
build-environment
dsl-tools
interop-domino
todos
technical-debt

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile