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

Is it smart to publish tab-activity-based app to Android 4.0+ devices?
Not able to register Broadcast receiver Dynamically
Two-lines ListView force closes in Android
Difference between Plain text input type and Person Name input type in Editext in android
WebView with SSL Client Certificate on Android 4 ICS
Android: UUID cannot serialize
Distance calculation from my location to destination location in android
Android network connection
dynamically populating maps in android
Split the screen on android tablet
The onBind method: how to make it selective?
Wrapping a scrollview in a tablelayout in XML
Android WebView: never reloading
my application freezes after entering into the loop
Drawing a pin on google map through android application
What is the unit of measurment for media duration in MediaMetadataRetriever

Categories

HOME
design-patterns
jmeter
rdbms
jsf-2.2
grafana
seo
javacc
database-normalization
maxscript
google-admin-sdk
missing-data
nstableheaderview
augeas
endeca
text-mining
mautic
why3
mxgraph
libusb
entitymanager
easyphp
asp.net-mvc-viewmodel
connector
replication
blade
squashfs
dataflow-diagram
exit
cppreference
calculation
gitlab-api
aws-codecommit
sammy.js
sql-delete
imx6
searchkit
python-pptx
latitude-longitude
salesforce-communities
wurfl
node-mssql
odroid
portforwarding
plr
ssrs-2014
apache-spark-dataset
servermanager
identification
tf
pair-programming
static-cast
rackspace-cloud
usart
redistributable
latin
google-cloud-console
resourcemanager
mta
query-by-example
lz77
grass
qbxml
sapi
binomial-theorem
jsvc
jquery-forms-plugin
dbaccess
execve
trdion2011
jqmodal
maven-scm
koala
spring-3
light
ie8-compatibility-mode
modular
font-awesome-4.0.0
pagedown
robotlegs
rmiregistry
josql
jsr286
apache-commons-dbutils
ikimagebrowserview
filemerge
creole
clrstoredprocedure
collectionviewsource
uideviceorientation
web-garden
isapi-extension
opml
sifr
strtod
web-application-project
asynchronous-wcf-call
fault-tolerance
firefox-3

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