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

Show layout like google agenda
Notify currently visible activity via broadcast
“Dangerous” Android permissions that don't need to be accepted by users
Error while Migrating Cordova app in CrossWalk
How can I automatically clear logcat output before each run in Android Studio?
Eclipse stock on launching app
Scaling bitmap image in custom view listview item
How can I make an local notification after app go to background a day in Android
Cant add audio to phonegap
#OnClick is not working in implementation of ButterKnife Library
Android : Mapping frequency obtained from FFT to musical notes
Log Cat not displaying anything?
unrequested permissions not declared in androidmanifest--crashlytics maybe?
Container for Android application : ListView
Eclipse wizard no longer creates activities in Android projects
Retrieve Android API 19 Libraries?

Categories

HOME
uml
notepad++
phpword
delphi-7
merge
ns-3
yandex
square
tvos
sendgrid-api-v3
github-enterprise
automatic-ref-counting
frequency-distribution
renjin
libusb
job-scheduling
standards
pyramid
mapstruct
r-mice
react-toolbox
highstock
moses
syntax-highlighting
jquery-multiselect
fable-f#
android-sharedpreferences
mat
genexus-sd
datastax-enterprise-graph
subclass
finagle
scatter3d
code-snippets
android-gridview
joomla2.5
arduino-ide
android-augmented-reality
z-notation
node-mssql
setup.py
watchface
movilizer
glm-math
outputcache
importerror
apache-spark-dataset
rfc3339
convex-optimization
azure-cli
boo
quicktime
webjars
myspace
wso2developerstudio
vorpal.js
nss
kiosk
thread-sleep
ascii-art
directdraw
sapi
opl
roadkill-wiki
flock
extjs-grid
ansi
telepat
bufferedinputstream
qtwebengine
infosphere-spl
template-deduction
radiant
gtm-oauth2
away3d
ice-cube
inappsettingskit
cffile
cmmi
process-explorer
route-provider
http-status-code-410
sqlclr
pdfviewer
saleslogix
subproject
catransform3d
listactivity
umra
nhprof
office-2007
eclipse-marketplace
web-garden
zend-rest
dsl-tools
xpsdocument
contentpresenter

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