Test Automation with agent-device (Part 2)
Описание и применение
В статье описывается настройка и запуск тестов на реальных iPhone и Android‑устройствах с помощью agent-device, включая подготовку сертификатов, управление приложениями и проверку реальных рекламных запросов.
Задача
Real devices are required to validate store-build updates, system dialogs, and real ads, which simulators cannot reproduce.
Результат
Enabled end‑to‑end UI tests on real devices, covering update paths, consent dialogs, and real ad behavior, with documented setup and cleanup steps.
Рабочий процесс
- Prepare iPhone: install signed XCTest runner via agent-device, enable developer tools security, enable UI Automation, keep screen unlocked.
- Sign runner automatically if Xcode account present, or manually create provisioning profile with fastlane sigh and set environment variables.
- Prepare Android: connect via USB or wireless debugging, ensure device appears in adb devices, add --serial to commands.
- Handle app installation: use devicectl to list, uninstall, and reinstall apps; manage TestFlight warnings and data backups.
- Run tests: agent-device drives real device, captures snapshots, logs, and handles system dialogs.
- Cleanup: uninstall runner and test app, verify state directory separation.
Доказательства
Simulators and emulators are enough to check app screens, but they cannot reproduce how a build shipped through the store behaves on a real user's device.
The Google Mobile Ads SDK automatically treats an emulator as a test device. logcat prints This request is sent from a test device.
On a real iPhone, agent-device installs an XCTest runner on the device. The XCTest runner is a test app that reads the screen and taps on your behalf, and it has to be signed with a development certificate to install.
- Дата записи: 2026-10-27T09:11:39.581Z