I am using andorid studio 3.2 and I am new to testing. I want to add a testing library but I am not getting what should i write in the dependencies section testImplentation or androidTestImplementation. What is the difference between these two?
If you create android project using Android Studio.
You can find three directories like following. (each directory called
- app/src/androidTest : for android UI test. It needs virtual or real device. (Espresso, UI automator)
- app/src/test : for android independent test.
androidTest directory contains test cases that touch the screen or check what is displayed on the screen.
test directory, we mainly do
unit tests such as testing one function.
But test directory is not only for Unit test. You can also write Integration test like HTTP call.
Even you can
UI test in
test directory using
Robolectric library.(It’s really fast rather than Espresso)
So what is
androidTestImplementation? (each called
- testImplementation : adds dependency for
- androidTestImplementation : adds dependency for
See this articles for details.