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

Layout Params: What imports do I use?
Lifecycle between activity and fragment
Replace strings in dex file
Animating a canvas object in Fragment From Activity
how to set coordinates for ibeacons?
Signed release apk locally transfered can't be installed? [closed]
onTouch and onClick not triggering properly
Show a selection mask effect on click on LinearLayout
Finding/Remapping bounds of OpenGL ES coordinate plane
Trying to add to existing value in SQLite Database
Bitmap Buffering
create a grid with cell heights and widths relative to screen size
gradle dependencie managment with sub dependencies (nested depenencies)
Making android app compatible with Kitkat and above versions
Google play in-app product price does'nt change
Why does my query by title not find manually created files/folders

Categories

HOME
mysql-workbench
mstest
devise
sublimetext
r-googlesheets
pdfbox
cublas
gembox-spreadsheet
zip
echo
webix
onedrive-api
flatpak
job-scheduling
aws-sdk
shortest-path
rubymotion
imagemap
react-toolbox
pimcore
dynamically-generated
xunit
ckfinder
tiki-wiki
outliers
android-maps
linked-data
vex
gitlab-api
event-flow
zend-debugger
paragraph
record
playstation-portable
card.io
hreflang
hard-drive
least-squares
getlasterror
openalpr
sessionstorage
release
connection-pool
visa
plaintext
laravel-elixir
preloader
signal-strength
uiimage
openrasta
vugen
tinymce-3
carrot2
arq
context-switch
spring-data-couchbase
vibrate
stax
x-tag
jboss-tools
riot
redis-cluster
html-to-pdf
libav
exim4
httpruntime.cache
dynamics-nav-2016
doctype
pyobjc
execve
create.js
lambda-architecture
grails-plugin-rabbitmq
winginx
websphere-esb
git-repo
inputmismatchexception
modular
unit-of-work
process-explorer
octal
pclzip
cascadingdropdown
asplinkbutton
wimax
device-width
dopostback
redis-py
panda3d
patricia-trie
listitem
subproject
usertype
apache-commons-dbutils
jqote
multiplatform
uipagecontrol
massive
quotation-marks
inline-formset
cdonts
ruby-1.8
ie-compatibility-mode
silent
eclipse-marketplace

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