---
title: Espresso Knowledge Check | TestingBot
description: 'Ten questions on the whole course. Answer them all, then press **Check
  answers**: the explanations appear under each question. This is a self-check; the…'
source_url:
  html: https://testingbot.com/resources/courses/espresso/knowledge-check
  md: https://testingbot.com/resources/courses/espresso/knowledge-check.md
---

Course

[Espresso Android Testing in Kotlin](https://testingbot.com/resources/courses/espresso)

Chapter 10 of 10

1. [1 Espresso Android Testing Tutorial in Kotlin](https://testingbot.com/resources/courses/espresso)
2. [2 Gradle Setup and Your First Espresso Run](https://testingbot.com/resources/courses/espresso/gradle-setup)
3. [3 ViewMatchers, ViewActions and ViewAssertions](https://testingbot.com/resources/courses/espresso/matchers-actions-assertions)
4. [4 Lists with RecyclerViewActions, and Espresso-Intents](https://testingbot.com/resources/courses/espresso/recyclerview-and-intents)
5. [5 Synchronisation and IdlingResources](https://testingbot.com/resources/courses/espresso/synchronisation-and-idling-resources)
6. [6 Test Isolation, Orchestrator and the Robot Pattern](https://testingbot.com/resources/courses/espresso/test-isolation-and-robots)
7. [7 Building the App APK and the Test APK](https://testingbot.com/resources/courses/espresso/build-the-apks)
8. [8 Run Espresso Tests on TestingBot](https://testingbot.com/resources/courses/espresso/run-on-testingbot)
9. [9 Running Espresso in CI with GitHub Actions](https://testingbot.com/resources/courses/espresso/ci-github-actions)
10. [10 Espresso Knowledge Check](https://testingbot.com/resources/courses/espresso/knowledge-check)

[Exit course](https://testingbot.com/resources/courses)

 Chapter 10 of 10 Intermediate 6 min read Updated Nov 2026 

# Espresso Knowledge Check

Ten questions on the whole course. Answer them all, then press **Check answers** : the explanations appear under each question. This is a self-check; the certification exam has its own questions.

1. Your team wants UI tests for an Android app's checkout screens, written by the Android developers and run on every pull request. Which tool fits best?

 UI Automator, because it can leave the app Espresso, because it runs inside the app and synchronises with the main thread Appium, because it is the only tool that runs on emulators Manual testing, because UI tests are always flaky

Screen-level tests owned by app developers are Espresso's home ground: same language and project as the app, compile-checked ids and automatic synchronisation. All three tools run on emulators, and UI Automator is for the parts outside the app.

2. A new test class compiles, but the run reports "The @Rule 'activityRule' must be public". What is wrong in the Kotlin code?

 The class is missing `open` `ActivityScenarioRule` needs a `lateinit var` The test runner in `build.gradle.kts` is wrong The rule is annotated `@Rule` instead of `@get:Rule`

Without the `get:` target, Kotlin puts the annotation on the private backing field, and JUnit rejects it. `@get:Rule` annotates the public getter.

3. `onView(withId(R.id.price))` throws AmbiguousViewMatcherException on a cart screen. What does that tell you?

 More than one view in the hierarchy has that id, typically one per list row The view exists but is not displayed yet The id was renamed and the test APK is stale Espresso timed out waiting for the screen

Ambiguous means "several matches". Row layouts reuse ids, so each visible row contributes one. Target a row with RecyclerViewActions or narrow the matcher.

4. A field has a text watcher that formats a phone number as you type. Which action exercises it like a user would?

 `replaceText("0471234567")` `clearText()` followed by `replaceText(...)` `typeText("0471234567")` `pressImeActionButton()`

`typeText` types character by character through the keyboard, so the watcher sees each keystroke. `replaceText` sets the whole value at once, which is faster but skips the per-character behaviour.

5. You need to tap the Delete button in the row that shows "Invoice 1043", somewhere far down a RecyclerView. Which approach works?

 `onView(allOf(withId(R.id.delete), hasSibling(withText("Invoice 1043")))).perform(click())` `actionOnItem` with `hasDescendant(withText("Invoice 1043"))` and a child-click action for the Delete button `actionOnItem` with `hasDescendant(withText("Invoice 1043"))` and `click()` `onView(withText("Invoice 1043")).perform(scrollTo(), click())`

The row is off screen, so plain `onView` cannot find it (options a and d). `actionOnItem` scrolls to it first; a plain `click()` taps the row's centre, not the Delete button, so you need an action that clicks the child view.

6. A "Call us" button starts `ACTION_DIAL`. What should the test assert, and how?

 That the app sent an `ACTION_DIAL` intent with the right number, using an `intending` stub and `intended` That the dialer app shows the number, using UI Automator Nothing; intents cannot be tested That the button is enabled, which proves the intent works

The app's responsibility ends at sending the correct intent. Espresso-Intents verifies exactly that, and the stub keeps the dialer from opening. Testing the dialer itself tests someone else's app.

7. A screen uses `Handler(Looper.getMainLooper()).post { ... }` to update a label. Does the test need an IdlingResource to wait for it?

 Yes, every Handler needs one Yes, but only on real devices No, but it needs a short `Thread.sleep` No; a message posted to the main looper is part of the queue Espresso already waits for

Espresso waits until the main thread's queue has nothing due. A post to the main looper is in that queue. IdlingResources are for work Espresso cannot see, such as other threads.

8. A suite passes with Gradle on your emulator, but on a device cloud some tests fail with leftover data from earlier tests. What is the most likely difference?

 The cloud devices run a different Espresso version The cloud runs tests in parallel inside one process Locally, Orchestrator with `clearPackageData` was resetting state between tests; the cloud run starts AndroidJUnitRunner directly The test APK was built in release mode

Orchestrator is configured in Gradle, not in the APKs, so it only helps where Gradle launches the tests. Tests that reset their own state pass in both places.

9. Which pair of files does TestingBot need for an Espresso run?

 The app's source code and the `androidTest` folder The app (`.apk` or `.aab`) and the test APK from `assembleDebugAndroidTest` The test APK and a JUnit XML file The app APK and a YAML flow

The cloud runs compiled code, like `adb` does: the app plus the instrumentation APK that contains the tests and the runner. YAML flows are Maestro, and JUnit XML is an output, not an input.

10. In GitHub Actions, the TestingBot step reports failed tests, but the workflow run is green. What is the first thing to check?

 Whether the step's exit code is being swallowed, for example by `|| true` or `continue-on-error` Whether the JUnit report was uploaded as an artifact Whether the build name is unique Whether `--async` is missing

The CLI exits non-zero when tests fail, which fails the step and the run, unless something in the workflow ignores the exit code. (`--async` would make it worse: the CLI returns before any result exists.)

Check answers

[Previous · Chapter 9 Running Espresso in CI with GitHub Actions](https://testingbot.com/resources/courses/espresso/ci-github-actions)
## You finished Espresso Android Testing in Kotlin

Put what you learned into practice. Run your tests on 6100+ real browsers and physical iOS and Android devices.

[Start free trial](https://testingbot.com/users/sign_up) [See pricing](https://testingbot.com/pricing) [Browse other courses](https://testingbot.com/resources/courses)

## TestingBot Espresso Certification

Turn this course into a free, resume-worthy credential: pass the exam, run the course suite on TestingBot, and get a verifiable certificate for your LinkedIn profile.

[How it works](https://testingbot.com/resources/courses/espresso/certification)
