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?
For example the testImplementation configuration extends the implementation configuration. The configuration hierarchy has a practical purpose: compiling tests requires the dependencies of the source code under test on top of the dependencies needed write the test class.
Fortunately, the implementation dependency configuration provides the same functionality as compile. You should always use implementation rather than compile for dependencies, as compile is now deprecated or removed in the case of Gradle 7+.
If you create android project using Android Studio. You can find three directories like following. (each directory called Source Set
)
The androidTest
directory contains test cases that touch the screen or check what is displayed on the screen. In the 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 testImplementation
and androidTestImplementation
? (each called Configuration
)
test
source setandroidTest
source setSee this articles for details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With