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

Need help in Android Studio: Text alignment
Launching app in another device gives Multiple dex files define error
Android Firebase Recycler view UI inside onDataChange()
Does Android package name matters for search in Google Play?
MediaPlayer listing songs in custom listview
Android Retrofit 2 issue in adapter
Remove old entry from ListView when Firebase is updated
Android NFC tag with URL opening browser, not my app
Init fragments for FragmentPagerAdapter when its parent visibility is set to GONE/INVISIBLE
check whether the youtube video exists or not in Android YoutubePlayer
Android SwitchCompat: OnClick check programatically if switch should be triggered
Compute all with one button [duplicate]
How to use net send from android
How to create an ACTION_VIEW intent that behaves like File Manager
Play Games Leaderboard refuses to open after a score has been submited
Android API PdfDocument not writing data in file using writeTo(outputStream)

Categories

HOME
uml
grok
oracle12c
database-normalization
soa
gembox-spreadsheet
jquery-ui-sortable
little-proxy
octave
endeca
plist
tput
pyramid
bourbon
database-connection
microsoft-ocr
scriptella
gmock
jackson-modules
spotipy
jaws
custom-controls
aws-codecommit
postback
sharepoint-workflow
swagger-php
latitude-longitude
docfx
imagenet
protein-database
c9.io
parser-generator
microsoft-metro
plr
servermanager
linter
clarifai
wcftestclient
netbeans6.8
facebook-pixel
subnet
rxtx
visual-studio-2008-sp1
gogs
kango-framework
stream-processing
kendo-upload
microsoft-reporting
xvim
google-books
vacuum
apache-commons-daemon
cwrsync
matlab-deployment
dot.js
gamekit
mobility
template-deduction
kissfft
reflector
live555
embedded-fonts
rolify
neos-server
gpars
diem
mkv
qi4j
patricia-trie
rmiregistry
apache-whirr
kqueue
infobright
android-holo-everywhere
uipagecontrol
binomial-heap
message-passing
nstokenfield
dojo-dnd
idatareader

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