Sample questions
Mq Permissions Lifecycle System InteractionsDifficulty 3
Why can't Espresso directly tap the button on the Android runtime permission dialog that appears when an app first requests, e.g., camera access?
- aThe dialog is rendered by a system process outside the app under test's own process✓
- bEspresso cannot simulate tap gestures on any button, only text input
- cEspresso tests must run with the app already force-stopped, so no dialog is ever visible
- dEspresso requires the device to be rooted before it can click any dialog
Explanation:The permission dialog belongs to the system UI process (not the app-under-test's process), and Espresso's synchronization model only reaches into the instrumented app's own process, so it cannot see or interact with that dialog.
Mq Permissions Lifecycle System InteractionsDifficulty 3
What capability does UI Automator (and similarly XCUITest) have that lets it interact with the Android runtime permission dialog, unlike Espresso?
- aIt runs the permission dialog inside the same process as the app under test
- bIt disables the permission system entirely for the duration of the test run
- cIt can inspect and interact with UI elements across process boundaries✓
- dIt replaces the system dialog with a fake one injected by the test framework
Explanation:UI Automator operates outside any single app's process and can traverse the whole device's UI hierarchy, including system-owned windows like the permission dialog, which is why it (or Appium drivers built on it) can dismiss such dialogs.
Mq Permissions Lifecycle System InteractionsDifficulty 1
What does the command adb shell pm grant <package> <permission> do?
- aIt installs the named permission as a new system-level permission on the device
- bIt opens the app's permission settings screen for the tester to grant manually
- cIt grants the named runtime permission to the named app directly✓
- dIt lists every permission the named app currently holds
Explanation:pm grant sets a runtime permission's state to granted for a given package directly through the package manager, which is why tests use it to pre-seed permission state without ever driving the dialog UI.
Mq Permissions Lifecycle System InteractionsDifficulty 2
What does the Appium capability appium:autoGrantPermissions do on an Android session?
- aIt automatically clicks 'Allow' on every permission dialog as it appears during the test run
- bBefore the app launches, it pre-grants the permissions declared as dangerous in its manifest✓
- cIt disables the app's manifest-declared permissions so no dialog can appear
- dIt grants root access to the Appium session so any permission check is skipped
Explanation:autoGrantPermissions works by pre-granting the app's manifest-declared dangerous permissions before launch (similar to running pm grant for each of them), not by clicking through a dialog that appears during the test.
Mq Permissions Lifecycle System InteractionsDifficulty 1
On iOS, what does xcrun simctl privacy grant <device> camera <bundle-id> do?
- aIt sets the named app's camera privacy authorization to granted✓
- bIt installs a virtual camera device into the simulator for the named app to use
- cIt records a video clip and feeds it into the named app's camera input
- dIt lists which privacy permissions the named app has requested so far
Explanation:simctl privacy grant sets a named privacy service's authorization state for an app on a given simulator directly, which is the iOS-side equivalent of pre-seeding permission state the way pm grant does on Android.
Mq Permissions Lifecycle System InteractionsDifficulty 2
In an XCUITest, what is the purpose of registering an addUIInterruptionMonitor handler before performing an action that may trigger a system alert, like a permission prompt?
- aIt prevents any system alert from ever being presented for the rest of the test run
- bIt lets the test respond to and dismiss a system alert that interrupts it mid-test✓
- cIt records a screenshot of every system alert for later manual review
- dIt forces the app under test to skip the code path that would show a system alert
Explanation:addUIInterruptionMonitor registers a handler that XCTest consults whenever a system alert (like a permission prompt) unexpectedly interrupts the test, letting the handler interact with and dismiss it so the original test steps can resume.