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 do I encrypt or hide my api url in android?
Android - Retrieving large text file from webserver
Does Android NDK work on Windows 8?
Fragment crashes after adding new code
Database for android online [closed]
Phonegap 3.4 doesn't copy android to platforms folder (ubuntu 12)
Skia debug info and Img_en error
Method name is striked
message NeedPermission when get token code
How do I properly change my existing project name in Android Studio?
Display integer value on TextView
How to fix Class Cast Exception While Casting List View to PullToRefreshListView in android
Generating PublicKey from Base64 encoded String
using google maps api in an android app
Showing error while trying to run mediaPlayer in AsyncTask
android design : fragment or view?

Categories

HOME
service-worker
beautifulsoup
apache-flink
rsa
package
sublimetext
can
appcelerator
opendj
ado.net
banner
retrofit2
commonjs
android-securityexception
filechannel
libc
speech-synthesis
plink
do-while
modbus-tcp
mvc-mini-profiler
firefox-addon
dreamweaver
google-content-api
google-data-studio
user-experience
poedit
blade
exploit
direct3d11
itunes
interbase
stackexchange
flooding
fractions
tpm
twiml
instantiation
keras-layer
reactjs.net
installscript
jwplayer6
mnist
xajax
docfx
dm-script
doc
postgresql-8.4
mesosphere
xbmc
term
jquery-ui-draggable
dotnet-httpclient
tinymce-3
aquamacs
context-switch
stdmap
java-6
libjpeg
d3-force-directed
mathcad
vibrate
django-1.10
swingworker
structuremap4
javafx-css
google-cloud-console
x-tag
mapinfo
scaffolding
expectations
lean
jclouds
embedding
cortex-m
ellucian-scribe
toran-proxy
coda
mod-proxy
eoferror
vacuum
amiga
haskell-warp
actionfilterattribute
openbabel
uncaught-typeerror
iso-prolog
nsmenu
kendo-dataviz
away3d
flex++
facebook-timeline
windows-98
apache-abdera
android-sdk-2.3
booksleeve
joomla3.1
pstack
saxparseexception
xcelsius
jqote
tournament
mbeans
dataform
cloudfiles
objective-j
ajax-polling
openfaces
opml
asynchronous-wcf-call
dsoframer
cardspace

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