Skip to content
Examples of UI Testing with Espresso, Mockk, androidx.test
Kotlin
Branch: master
Clone or download
Latest commit 2b7944a Dec 14, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.idea mocking dependencies with mockito Nov 22, 2019
app TestRule for EspressoIdlingResource (compares TestRule with TestWatcher) Nov 28, 2019
gradle/wrapper
.gitignore first commit Nov 20, 2019
README.md Update README.md Dec 14, 2019
build.gradle mocking dependencies with mockito Nov 22, 2019
gradle.properties first commit Nov 20, 2019
gradlew first commit Nov 20, 2019
gradlew.bat first commit Nov 20, 2019
settings.gradle first commit Nov 20, 2019

README.md

UI Testing for Beginners

UI Testing for Beginners

Watch the video course here (FREE): UI Testing for Beginners

Espresso Samples:

Activities in Isolation

  1. ActivityScenario vs ActivityScenarioRule
  2. Matching with text in view

Activity Navigation

  1. Basic activity navigation testing

Test Suites

  1. Creating test suites to run multiple test classes at once

Fragments in Isolation (simple)

  1. Simple use case testing the fragments and their behavior with no dependencies

Fragments in Isolation (with Mockk & FragmentFactory Dependencies)

  1. Testing kotlin final classes (making them open for testing)
  2. More complex tests and why dependency injection is recommended
  3. Providing dependencies with a FragmentFactory

Fragments Navigation

  1. Ensuring correct fragment is in view after any particular action is taken.

Intents (image from gallery)

  1. Selecting an image from android device gallery and confirming the correct one is received by onActivityResult
  2. IntentsTestRule
  3. Custom Image Matcher

Intents (image from camera)

  1. Taking a new image with camera and confirming the correct one is received by onActivityResult
  2. IntentsTestRule
  3. Custom Image Matcher

Dialog (detecting if visible)

  1. Material Dialogs
  2. Showing a dialog and confirming it is in view
  3. Dismissing a dialog and confirming it is out of view

Dialog (capture input)

  1. Material Dialogs
  2. Capturing input from dialog and passing to fragment

Toasts (custom Toast Matcher)

  1. Confirming a toast is showing using a Custom Toast Matcher

RecyclerView

  1. Confirming correct data in RecyclerView
  2. Clicking list items
  3. Navigating to different fragments when list item is clicked
  4. Back navigation testing
You can’t perform that action at this time.