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

Signpost Oauth authentification on android application
onclicklistener for subitems of listview
Android, line width, pixel size
Android tablet in Emulator is not picking up the right layout
Jar not found error in Android
Custom style is interfering with platform dialogs
How can I calculate getOrientation() without enabling compass?
Stackoverflow Exception When Working on 2.7in QVGA in Graphical Editor (Eclipse)
Can Android support dp's less than 1dp?
How do I implement the Google Places API in Android?
Working with new AndEngine
How to show activity title on right side in Android
Is there away to change the height of map view programmatically?
Check if user is connected via wifi or (Google Chrome on Android)
Html button width in percent in Webview
Give app widget button custom colour with rounded rectangle shape

Categories

HOME
polymer
mjml
angular2-material
rsa
components
yandex
mips
onclick
extjs4.2
vimdiff
favicon
renjin
feathersjs
template-engine
delphi-xe5
user-experience
exit
scriptella
aggregation
fragment-backstack
nsurl
left-join
rselenium
linkedhashmap
keras-layer
openerp-7
timing
cin
tasm
apriori
placeholder
signal-strength
identification
datamaps
convex-optimization
zenhub
arq
semantic-logging
context-sensitive-grammar
spring-data-couchbase
git-flow
avx
gpg-signature
pybrain
google-photos
materialized-path-pattern
slackware
cudd
latin
envi
expectations
firebase-security
google-query-language
hadoop-partitioning
thread-sleep
nio2
jparsec
jaunt-api
vhosts
boomerang
gocql
xvim
page.js
viola-jones
linked-tables
mirror
ejb-2.x
parallel-testing
functional-java
wxformbuilder
buffering
gae-quotas
koala
qscrollarea
conditionaltagsupport
git-repo
xmltodict
sphinxql
ie8-compatibility-mode
cnf
dolby-audio-api
jquery-1.9
argouml
koken
entity-attribute-value
u2netdk
multiplatform
creole
message-passing
build-environment
wcf-instancing
application-planning

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App