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 get ACTION_HEADSET_PLUG in OnCreate()
htaccess redirect params from iOS doesn't work
Android || How to parse the Image from one activity to another?
InflateException when using chrisjenx CalligraphyLayoutInflater , android.view.InflateException
Draw Here MapsView into a GLSurfaceView
Facebook login - issue after Graph request
I am trying to show retweet icon on android app using fabric
License file not present in my final APK if i am using proguard
Prevent background image from streching in Android layout
android Webview Capture softkeyboard Done button click
Can I test life cycle methods of Activities and Fragments separately?
Android - Method call when app is destroyed/closed
Apply SuperscriptSpan to Spannable Without Changing LineHeight
Some links were not opened in FromHtml with a href
Gaussian Blur - black and white image turns to red and orange
ProcessException: aapt finished with non-zero exit value 2

Categories

HOME
depth
apache-spark-mllib
camera
requirements
alarm
mips
hugo
polling
retrofit2
odoo-8
openstreetmap
octave
google-form
flash-player
3nf
magnetic-cards
cumulocity
altera
dimensional-modeling
google-data-studio
pyramid
symfony-console
shortest-path
google-maps-autocomplete
microsoft-ocr
visual-glitch
php-mysqlidb
roundup
game-theory
interbase
ms-access-web-app
jasmine-node
comparable
vex
twiml
playstation-portable
arduino-ide
searchkit
sharepoint-workflow
imagenet
cin
p4merge
unordered-map
tcc
stylecop
phpdbg
ovf
xbmc
globalize
configurationmanager
edit
headless
java-websocket
universal-analytics
branch-prediction
chromium-os
slackware
segment-io
vulcanize
eigenvector
pre-build-event
query-by-example
spreadjs
hadoop-partitioning
lz77
realsense
concept-insights
linklabel
video-player
finalbuilder
vacuum
java-security
document-repository
theos
ssis-data-flow
teaspoon
device-tree
rcaller
grails-plugin-rabbitmq
koala
ecslidingviewcontroller
c++builder-xe5
windows-phone-8-sdk
mongohq
pagedown
idn
qtconcurrent
saleslogix
objectquery
floating-point-exceptions
denied
user-tracking
catransform3d
automationelement
massive
xui
tmx
message-passing
silverlight-oob
unmanagedresources
great-circle

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