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

Implement low-frequency live card in google glass
How do I persist an attribute in an activity that I'm navigating back up to?
How to parse an xml? [duplicate]
Redirect User to Play store From Android App
Multiple dex files define Landroid/support/v4/ in android studio
How to repeat the song untill not stop playing off
Display Google Maps on second screen of Android application
Android: Specifying style of programmatically added radio buttons when focused
Android Serial Read from Arduino Output through USB
Android Studio, Gradle Errors. Content not allowed in Prolog
How to connect an xml layout with a view ANDROID
special character are not displayed properly in android webView
Settings show in Samsung emulator but not on actual device
Django Rest Framework + gson : utf-8 can't decode
Android, code optimization
Odd crash on app happening when I build from my machine, however doesn't crash from another person's machine

Categories

HOME
google-app-engine
turing-machines
eslint
depth
rsa
solver
owl-carousel
appcelerator
bitbucket-api
edge
scripting
big-o
zip
jetty
nuget-package
crystal-reports-2013
trac
lanczos
qpython
minecraft-forge
opengl-es-3.0
stellar.js
selenium-ide
onedrive-api
selectize.js
qsqlquery
keytool
esoteric-languages
foreign-keys
mapstruct
oledb
windows-xp
symbols
babel
ember-cli
object-storage
data.stackexchange.com
ms-access-web-app
has-and-belongs-to-many
intersystems-cache
user-defined-functions
boost-asio
userdefaults
autodesk-designautomation
pdw-file-browser
browser-extension
baidu-map
numpy-broadcasting
openerp-7
docfx
salesforce-communities
dm-script
odroid
congestion-control
xmldocument
puredata
double-click
textsum
openrasta
yii2-api
stdmap
java-bytecode-asm
sundials
css-transforms
mathcad
chromium-os
cubism.js
stax
reporting-services-2012
hadoop-2.7.2
iotivity
jodd
dup
xdoclet
nservicebus5
stream-processing
libav
nio2
grass
asyncdisplaykit
jnlua
gocql
vacuum
baasbox
alloy-ui
mass-assignment
dbaccess
jqmodal
gnumeric
mutual-authentication
clickbank
amslidemenu
breakout
cnf
http-status-code-410
swfobject
fb.ui
apache-abdera
android-sdk-2.3
patricia-trie
pstack
paginator
predicatebuilder
screen-size
cuteeditor
dataform
commerceserver2007
google-wave
pbcopy

Resources

Encrypt Message