testing-setup
Was er macht
Dieser Skill prüft, wie ein Android-Projekt seinen Code heute testet, und plant eine Testeinrichtung. Er kann die Testbibliotheken und Testumgebungen für Unit-, UI-, Screenshot- und End-to-End-Tests hinzufügen. Er ist für Android-Entwickler gedacht, die eine funktionierende Teststrategie wollen.
Wann du ihn nutzt
- ✓Wenn dein Android-Projekt wenige oder keine Tests hat und du eine Testeinrichtung willst.
- ✓Wenn du Screenshot-Tests für Compose- oder View-Bildschirme hinzufügen willst.
- ✓Wenn du wissen willst, welche Testbibliotheken und Mocking-Werkzeuge dein Projekt bereits nutzt.
Link zum Skill
https://github.com/android/skills/blob/main/testing/testing-setup/SKILL.mdKopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.
So nutzt du ihn
Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.
Fertige Nachricht zum Einfügen
Für Claude Code, Codex oder Cursor: Führe den Befehl in deinem Projektordner aus, dann wird der Skill installiert.
Lade die SKILL.md herunter und lege sie in den Skills-Ordner deines Agenten.
Beispielanfrage an deine KI
“Schau dir die Testeinrichtung meines Android-Projekts an und füge die Bibliotheken für Unit- und Compose-UI-Tests hinzu.”
5 neue Skills pro Woche. 1 Minute Lesezeit.
So funktioniert es
Der Skill liest deinen Versionskatalog und die Build-Dateien, um das Framework für Abhängigkeitsinjektion, die Testframeworks, die Mocking-Werkzeuge und die Art der Oberfläche zu finden. Danach ergänzt er die fehlenden Bibliotheken und Testumgebungen, die zum Projekt passen.
Technischer Inhalt (originale SKILL.md)
Originaltext des Autors, auf Englisch, direkt von GitHub.
Step 1: Analyze the current testing setup
To understand the testing setup of an existing project, look for these dependencies in the libs.versions.toml file, or build files:
- Dependency Injection framework used. For example, Hilt, Koin, Anvil, or vanilla Dagger.
- Unit (local) testing framework this project uses. For example, JUnit4 or JUnit5.
- Mocking framework (if any) used for unit tests, and for instrumented and UI tests. For example, Mockito or Mockk.
- Robolectric. Identify which of these three uses apply:
- Used in unit tests to have fakes for platform entities
- To run behavior UI tests without a device or emulator. For example, used to run Espresso or Compose tests.
- To do screenshot testing with Roborazzi
- Is the app 100% Compose, Views or hybrid?
- Behavior UI tests:
- Compose Tests (
androidx.compose.ui:ui-test-*) - Espresso Tests for Views. Check for wrappers such as Kaspresso. Dependencies:
androidx.test.espresso:espresso-core,androidx.test:runner,androidx.test:rules.
- Compose Tests (
- Screenshot tests. Identify which of these types the project uses:
- Instrumented (device-based). For example, using Dropshots.
- Based on Robolectric, so they run locally. For example, using Roborazzi.
- Based on LayoutLib, so they run locally. For example, Paparazzi, or the Compose Preview Screenshot Testing tool.
- End to end tests (also known as Release Candidate tests) always run on device and use high-level frameworks such as UIAutomator, Appium, or Robotium.
- Generate a Markdown report with the analysis
Step 2: Set up Dependency Injection frameworks for testing
If there is no Dependency Injection framework, install one: if it's a multiplatform application, ask the user whether they want to install Koin, or kotlin-inject. If it's not multiplatform, install Hilt.
Install the testing dependencies (for example com.google.dagger:hilt-compiler
that should be applied with a kspAndroidTest configuration).
[!IMPORTANT] Important: Always consult the documentation of the applicable framework to learn about testing (for example: Hilt testing guide, Koin Instrumented tests).
For instrumented tests, create and configure (by adding
testInstrumentationRunner to the build gradle files) a new test runner and
apply the testing rules required by the framework (for example in Hilt, annotate
your test classes with @HiltAndroidTest and apply the HiltAndroidRule).
Other frameworks use other mechanisms, consult their documentation.
Step 3: Install frameworks
Unless otherwise specified, respect the current stack of testing frameworks.
If there are no testing frameworks, and the user didn't specify any preference, install the following:
JUnit4 for local and instrumented tests
JaCoCo for test coverage
For UI tests: if the project has views, Espresso. If it's fully Compose, use the Compose Testing APIs.
Robolectric to run UI Tests
Compose Preview Screenshot Testing tool for screenshot tests. Check the project's AGP version first, then pick the matching setup and follow it strictly:
- AGP 9.5.0-alpha03 or higher (recommended): configure an AGP test suite using
testOptions { screenshotTests.create(...) }, as described in Screenshot testing with test suites. - Lower AGP versions: use the legacy standalone plugin setup with
com.android.compose.screenshot, and tell the user it's deprecated. Don't upgrade AGP as part of setting up screenshot tests. Mention that test suites are available on 9.5.0-alpha03 or higher, and leave the upgrade as a separate decision.
Don't combine both setups in the same module. If the project already uses the standalone plugin and its AGP version supports test suites, offer to migrate it using the tasks and paths mapping table in Screenshot testing with test suites.
- AGP 9.5.0-alpha03 or higher (recommended): configure an AGP test suite using
Dropshots for device screenshot tests
If a mocking framework is necessary, install Mockk (
io.mockk:mockk). Do not install it unless it is clearly necessary.
If instrumented screenshot tests are requested, install Dropshots.
If end-to-end testing is requested, install
Häufige Fragen
Schreibt er meine eigentlichen Testfälle?
Der Skill konzentriert sich auf die Testeinrichtung und die Testumgebungen. Welche Verhaltensweisen du testest, entscheidest du selbst.
Welche Arten von Screenshot-Tests kennt er?
Er erkennt gerätebasierte Screenshot-Tests und lokale, die auf Robolectric oder LayoutLib beruhen.
Welche Frameworks für Abhängigkeitsinjektion erkennt er?
Er erkennt Frameworks wie Hilt, Koin, Anvil und Dagger in der Grundform.
Details
Originalbeschreibung des Autors
Analyze and create a testing strategy for Android apps - install testing libraries, set up test infrastructure, create harnesses for unit tests, UI tests, screenshot tests, and end-to-end tests.
repo: android/skills
Beliebtheit
- GitHub-Sterne
- 10k
- Platz im Ranking
- #11937
- Lizenz
- Apache-2.0
- Aktualisiert
- 29.10.2026
Kommentare
- …
Weitere Skills aus diesem Repository
agp-9-upgrade
10kHilft deinem Agenten, eine Android-App auf Android Gradle Plugin 9 zu aktualisieren und die Breaking Changes abzuarbeiten. Nicht für Multiplattform-Projekte.
camerax
10kHilft deinem Agenten, Kamerafunktionen für Android mit CameraX zu bauen, einschließlich Videoaufnahme, Hardwaresteuerung, ML Kit und Media3-Effekten.
android-for-cars-parked-apps
10kHilft deinem Agenten, eine Android-Video-, Spiele- oder Browser-App so anzupassen, dass sie als geparkte App in Android Auto und Android Automotive läuft.
appfunctions
10kHilft deinem Agenten, in einer Android-App wichtige Abläufe zu finden und sie als AppFunctions bereitzustellen, die KI-Agenten und Sprachbefehle ausführen können.
Ähnliche Skills
test-driven-development
311kBringt deinem Agenten bei, vor jedem Feature oder Fix zuerst einen fehlschlagenden Test zu schreiben, ihn fehlschlagen zu sehen und dann den kleinsten passenden Code zu schreiben.
verification-before-completion
311kBringt deinem Agenten bei, echte Prüfungen auszuführen und ihre Ausgabe zu lesen, bevor er behauptet, eine Aufgabe, ein Fix oder ein Build sei fertig oder bestehe.
migrate-to-shoehorn
310kErsetzt riskante Typumwandlungen in deinen Testdateien durch die Bibliothek shoehorn, damit Tests mit unvollständigen Daten arbeiten und trotzdem die Typprüfung bestehen.