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

Animatedly reduce button size on press and regain it's size on release
Xamarin: System.IO Can't find File.Create(string path, int bufferSize, FileOptions options)
Android SoundPool sound playback intermittent
Migration needed for Google App Invites to Firebase Invites?
How to animate an ImageButton into invisibility
Firebase Remote Config: Can't read any values, but fetch is successful
Let screen off after releasing a wakelock with ACQUIRE_CAUSES_WAKEUP flag
How to add support of marshmallow to existing pre Marshmallow Application
Android HttpURLConnect POST Stream Size
my android app is only working on android version 5 ,dosent work in version 4 or 6
FATAL EXCEPTION: AsyncTask #1 caused by: java.lang.NullPointerException
Android: Decrease the width of tab image and space between tabs in TabHost
In Shopify Android buy sdk which activity is launched when you click on the checkout button
Different strings for different screen sizes
How to make Cardview According to material design in android?
ScrollView can't show the last element

Categories

HOME
asp.net-web-api
xml
jpa
spark-streaming
fuelux
error-handling
alarm
edge
static-site
cublas
visual-studio-emulator
lanczos
teechart
fabric.io
android-intent
linear-algebra
asp.net-mvc-viewmodel
cfml
nim
poedit
angular-routing
short-url
comparator
windows-server-2003
stackexchange
jackson-modules
fractions
iis-express
tizen-tv
corenlp-server
custom-controls
recurring-events
complex-numbers
powershell-ise
utorrent
angularjs-material
dsx-desktop
hreflang
hard-drive
azure-arm
linqpad
sharp-snmp
lpsolve
oracle-service-bus
importerror
memory-mapping
monkey-testing
procfile
httr
optimizely
geotiff
video-conferencing
mach-o
structuremap4
rsa-archer-grc
stripe-connect
slackware
cudd
mapxtreme
redbeard-ios
latin
nikeplus-api
eigenvector
simevents
refinerycms
directdraw
sapi
lazybones
microsoft-reporting
ons-api
opserver
dock
branch-and-bound
keyup
alloy-ui
ms-access-2000
entity-framework-4.3
addressing-mode
entry-point
imagefilter
lambda-architecture
live555
winginx
spring-remoting
file-not-found
git-repo
sphinxql
windows-phone-8-sdk
kogrid
workitem
process-explorer
twisted.web
joomla3.1
curb
redis-py
pstack
pyunit
thttpd
winmain
multiplatform
uipagecontrol
socketserver
qglwidget
luajava
resharper-6.0
rowlex
eclipse-marketplace
mathematical-notation
software-lifecycle
localizable.strings

Resources

Encrypt Message