Irurueta Android Test Utils
| This documentation was generated with the assistance of AI. Please report any inaccuracies. |
irurueta-android-test-utils is a small Android library (package com.irurueta.android.testutils) with utilities
that simplify writing unit tests and instrumented tests for Android code written in Kotlin.
It exists to remove three recurring chores from Android test suites:
-
reaching private functions and properties of the class under test without changing their visibility,
-
running a test only on an emulator, only on a real device, or only when a custom condition holds,
-
simulating touch gestures (tap, double tap, drag, pinch) from an instrumented test.
Components
| Component | Where it runs | Purpose |
|---|---|---|
Reflection helpers ( |
Unit tests and instrumented tests |
Top-level inline functions such as |
Conditional ignore ( |
Instrumented tests (JUnit 4) |
A JUnit 4 |
Gesture helpers ( |
Instrumented tests |
An |
How a conditional ignore is decided
ConditionalIgnoreRule inspects each test method before it runs and decides whether to replace it:
Whether the device is an emulator is decided by a RealDeviceEvaluator, which can be replaced. See
Conditional ignore for the details.
Public API at a glance
| Type or function | Purpose |
|---|---|
|
JUnit 4 |
|
Annotation on a test function: skip it when its |
|
Interface with a single |
|
Annotations on a test function: run it only on an emulator / only on a real device. |
|
Decide whether tests are running on an emulator or on a real device. |
|
Reflection helpers, each available as an extension function and as a function taking a |
|
|
Where to go next
-
Installation: add the dependency to your test source sets.
-
Conditional ignore, Reflection helpers and Gesture helpers: how to use each component.
-
Building, testing and contributing: build the library and this site.
-
Reference: API documentation and other links.