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

OsmDroid setCenter centers around wrong place
Android Lollipop Activity Screen corrupted [duplicate]
NullPointerException in GCM Push Notification while Json Parsing in android
custom video camera doesn't start - android
Wechat Moments not in the options of Intent.createChooser matching ACTION_SEND
Figure out Latitude and Longitude
adb command list to perform different functions
Embedding emoji(emoticons images) to custom softkeyboard android
android Could not lock surface : dequeueBuffer failed (Unknown error 2147483646)
Default sdcard path in android
Avoiding multiple/double/two permission screens when getting a token via Google Play Services
android converting activities to fragments
Android memory and disk cache http client using Picasso
Real time tracking of android device on server request
How to text message send using timing in android
Android Studio exclude package from build [duplicate]

Categories

HOME
grok
facebook-oauth
c++11
saml-2.0
requirements
entity-framework-core
vxml
emscripten
ado.net
crystal-reports-2013
opengl-3
boto3
special-characters
recordrtc
qpython
google-schemas
github-enterprise
automatic-ref-counting
enterprise-architect
eip
scrolltop
powershell-v5.0
mvc-mini-profiler
easyphp
wolframalpha
undertow
pagespeed
pimcore
monit
froala
pylons
twiml
ntp
userdefaults
jbutton
jett
sendbird
modalviewcontroller
browser-extension
xcode7.3
cd
sessionstorage
linq-to-objects
mongoose-schema
urlsession
mcustomscrollbar
odoo-website
chronicle-map
wc
puredata
jquery-ui-draggable
chai-as-promised
libjpeg
bootstrap-tags-input
renaming
stripe-connect
dotnetnuke-7
gogs
refinerycms
http-status-code-401
cassia
nss
html-to-pdf
findfirst
grass
spring-retry
concurrentmodification
jdi
microsoft-reporting
xvim
poppler
slash
uncompress
branch-and-bound
cross-join
viewer
iiop
post-commit-hook
with-statement
named-parameters
malformedurlexception
maven-scm
getopt
accesscontrolexception
eclipse-kepler
c++builder-xe5
breakout
gpars
merb
jquery-blockui
subproject
predicatebuilder
apache-commons-dbutils
flex-mobile
gobject-introspection
ikimagebrowserview
automationelement
creole
tmx
delimited-text
jqueryform
eclipse-marketplace
application-verifier
feasibility
great-circle
idatareader

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App