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

Why this exception is coming ?java.lang.IllegalStateException [duplicate]
Android Facebook Video Upload Error Using Android API 4+
savedInstanceState in Fragment doesn't work
What is the function of the “loginName = ”Friend“” below?
Parse table using JSOUP and display in webview
how to share android studio application folder to program with two computers
How to increase image quality
N-Level dynamically ExpandableListView
Parsing issue of wordpress json data in android
Usage of vector Image in TextView Left drawable causing force close?
How to use PlaceAutoCompleteFragment widget in a Fragment - Android?
Android NDK ndkbuildFailed
org.json.JSONException: No value for salim_innova
Shell command 'ls' in Android fails: Syntax error: “(” unexpected
GetTag of Fragment returns the null object reference
Android : Skype loader animation

Categories

HOME
cheerio
phpmyadmin
datastore
pascal
mstest
solaris
requirements
access
cublas
mips
vxml
hpc
crystal-lang
augeas
ibeacon-android
x-cart
angular-dart
jsonpath
php-5.6
magnetic-cards
firefox-addon
easyphp
mapstruct
poedit
imagemap
dynamically-generated
syntax-highlighting
quantlib
errbot
cppreference
iis-express
aws-codecommit
python-import
roblox
watchman
timing
nohup
odroid
demo
chef-solo
stringtokenizer
install.packages
bindingnavigator
show-hide
procfile
httr
mesosphere
getchar
gpg-signature
flyout
d3-force-directed
filenet
vcloud-director-rest-api
latin
iotivity
resourcemanager
jquery-jscrollpane
wso2developerstudio
installshield-2010
pre-build-event
freepbx
np-spring
highland.js
atan2
sapi
terracotta
forwarding
sapscript
canalyzer
sha512
alloy-ui
mraid
kubuntu
rrule
cosine-similarity
ssis-data-flow
teaspoon
mintty
grails-plugin-rabbitmq
openargs
mt4j
visual-studio-express
jeromq
hidapi
facebook-timeline
octal
qi4j
jquery-blockui
veracity
iboutlet
subproject
window-decoration
entitydatasource
photolibrary
undefined-index
aspmenu
zen
leader

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