$ show KasperskyLab/Kaspresso
Kaspresso is a comprehensive Android UI testing framework built on top of Espresso (via Kakao) and UI Automator (via Kautomator), providing a Kotlin DSL for writing stable, readable tests. It offers extensive built-in reliability mechanisms: flaky safety (automatic retries with configurable timeouts), auto-scroll fallback, system dialog handling, and element reloading. The framework includes a modular interceptor architecture for customizing test behavior, device manipulation APIs (network, location, phone, permissions, logcat, screenshots, video recording), and integration with Allure for reporting and Jetpack Compose for modern UI testing. Additionally, it provides an ADB server for executing shell commands on the device and a command-line tool for generating page objects from UI dumps. The codebase is well-structured with multi-module Gradle projects, convention plugins, and extensive sample apps demonstrating real-world usage.
The LLM identified 4 files worth highlighting for reuse:
Implements reliable message transfer over Java sockets using a length-prefixed framing protocol. Handles partial reads, chunked writes, and connection termination with proper exception propagation. This class encapsulates the low-level socket I/O and can be reused in any project requiring robust socket message exchange between a desktop client and Android device.
Core retry algorithm used by Kaspresso's flaky safety mechanisms. Implements a loop with configurable timeout, interval, and allowed exceptions. Uses ReentrantLock and Condition for precise waiting and cancellation, and Timer for interval timing. While it imports internal Params, the algorithmic pattern (poll with backoff, predicate-based failure filtering) is reusable in any similar retry scenario.
Provides pixel-by-pixel image comparison for screenshot testing. Computes a normalized dissimilarity score from RGB channel differences, returns a diff image marking changed pixels in red. The class is self-contained (only depends on standard Java BufferedImage and Android Bitmap) and can be extracted for any visual regression testing need.
Optimizes verbose logging by detecting and collapsing repeated consecutive log messages. Uses a sliding time window and deduplication counter to replace duplicates with a summary line (e.g., 'Previous line repeated X times'). This component is fully independent (no internal imports) and reusable in any logging system where reducing noise is valuable.