UI Testing for Beginners
Watch the video course here (FREE): UI Testing for Beginners
Espresso Samples:
Activities in Isolation
- ActivityScenario vs ActivityScenarioRule
- Matching with text in view
Activity Navigation
- Basic activity navigation testing
Test Suites
- Creating test suites to run multiple test classes at once
Fragments in Isolation (simple)
- Simple use case testing the fragments and their behavior with no dependencies
Fragments in Isolation (with Mockk & FragmentFactory Dependencies)
- Testing kotlin final classes (making them open for testing)
- More complex tests and why dependency injection is recommended
- Providing dependencies with a FragmentFactory
Fragments Navigation
- Ensuring correct fragment is in view after any particular action is taken.
Intents (image from gallery)
- Selecting an image from android device gallery and confirming the correct one is received by onActivityResult
- IntentsTestRule
- Custom Image Matcher
Intents (image from camera)
- Taking a new image with camera and confirming the correct one is received by onActivityResult
- IntentsTestRule
- Custom Image Matcher
Dialog (detecting if visible)
- Material Dialogs
- Showing a dialog and confirming it is in view
- Dismissing a dialog and confirming it is out of view
Dialog (capture input)
- Material Dialogs
- Capturing input from dialog and passing to fragment
Toasts (custom Toast Matcher)
- Confirming a toast is showing using a Custom Toast Matcher
RecyclerView
- Confirming correct data in RecyclerView
- Clicking list items
- Navigating to different fragments when list item is clicked
- Back navigation testing