Injecting dependencies

This project is mainly to test UI the application and so we need to implement Espresso. Write down the given lines to implement Espresso in the dependencies{} block of build.gradle (Module—app):

testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'

// Espresso UI Testing dependencies.
androidTestImplementation "com.android.support.test.espresso:espresso-core:3.0.2"
androidTestImplementation "com.android.support.test.espresso:espresso-contrib:3.0.2"
androidTestImplementation "com.android.support.test.espresso:espresso-intents:3.0.2"

Then in the same file, add the code to implement the JUnit3 and JUnit4 tests against an Android package in the android{} block:

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

AndroidJUnitRunner is the instrumentation runner. It mainly controls the test APK, the environment, and all of the test launches. 

Now sync the project to download and add the dependencies to the project.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.67.16