testing-android-code
Skill by bitwarden
Guides writing and reviewing Android unit and UI tests in the Bitwarden codebase. It covers ViewModel, Compose, repository and service tests, and is aimed at developers working on Bitwarden Android.
Install testing-android-code
Built from the published package, never by AI.
git clone --depth 1 https://github.com/bitwarden/android /tmp/android && mkdir -p ~/.claude/skills && cp -r /tmp/android/.claude/skills/testing-android-code ~/.claude/skills/testing-android-codeRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/bitwarden/android /tmp/android && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/android/.claude/skills/testing-android-code ~/.gemini/antigravity-cli/skills/testing-android-codeAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Step-by-step: install testing-android-code in Antigravity CLI
Skills can run scripts on your machine. Some need an API key: check the README.
About
This agent skill gives Bitwarden-specific guidance for testing Android code. It describes the base classes to extend for ViewModel, Compose and service tests, and explains how to use StateFlow and EventFlow with Turbine. It also covers fake implementations, test data builders such as createMockCipher and createMockSend, and Result helpers like asSuccess and asFailure.
The skill is written for developers writing or reviewing tests in the Bitwarden Android project. It lists common mistakes, such as wrapping assertCoroutineThrows in runTest, and points to reference files and complete examples. It also refers to docs/ARCHITECTURE.md for broader architecture and testing philosophy.
Written from the project's SKILL.md and checked against it.
What it can do
- BaseViewModelTestBase class for ViewModel tests with dispatcher setup and a stateEventFlow helper.
- BitwardenComposeTestBase class for Compose screen tests with managers, theme and a fixed Clock preconfigured.
- BaseServiceTestBase class for service tests using MockWebServer.
- StateFlow vs EventFlow guidanceExplains which assertion to call first for StateFlow and EventFlow when testing with Turbine.
- Test data buildersDescribes createMock helpers for cipher, sync, send, profile and attachment models.
- Result type testingShows how to use asSuccess, asFailure and assertCoroutineThrows in assertions.
- Fake implementationsLists FakeDispatcherManager, FakeConfigDiskSource and FakeSharedPreferences for tests.
- Test organization and namingGives file layout, test naming conventions and placement of test constants.
What you need
- JUnit 5
- MockK
- Turbine (app.cash.turbine)
- kotlinx.coroutines.test
- Robolectric
- Compose Test
Try asking
- Write a ViewModel test for a new button click that updates state
- Review this Compose screen test and suggest Bitwarden-style fixes
- Why is my Bitwarden repository test failing with a coroutine exception?
Good to know
- Tests run with the en-US locale, so other locales should not be assumed.
- Advises calling assertCoroutineThrows directly and not inside runTest.
- Points to separate reference files and examples for full detail.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: .claude/skills/testing-android-code/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
-
SKILL.md12 KB -
examples/compose-screen-test-example.md10 KB -
examples/repository-test-example.md8 KB -
examples/viewmodel-test-example.md5 KB -
references/critical-gotchas.md22 KB
Show all 7 files
-
references/flow-testing-patterns.md7 KB -
references/test-base-classes.md8 KB
Alternatives to testing-android-code
All alternatives →Runs a 7-stage workflow for auditing, cleaning up and reviewing GitHub repositories, plus competitor analysis. Written for developers who want a repo checked for secrets, junk files and documentation gaps.
Teaches an AI assistant to build, debug and explain Gradio web UIs and ML demos in Python. It covers the core API, components, event listeners, layouts and the MCP server option. Aimed at Python developers who work with Gradio.
Recommends menus, buttons, toolbars and disclosure controls for Apple platforms using Human Interface Guidelines conventions. Built for developers and designers making iOS, iPadOS, macOS or visionOS interfaces. Checks existing project design context before asking questions.
Creates production-ready FastAPI project structures with async patterns, dependency injection, and error handling. It is for developers starting new FastAPI applications or backend API projects.
Analyzes Android apps to find user workflows to expose as AppFunctions, so AI agents and system shortcuts can run them without opening the app UI. Generates Kotlin code and refines KDoc for Android developers.
Creates, edits, validates and runs Agent QA tests, suites and hooks through MCP or CLI. It keeps canonical IDs and schema contracts intact, for developers and QA teams using Agent QA.
Compare with openclaw-github-repo-commander, gradio or hig-components-menus
testing-android-code: common questions
When should I use StateFlow or EventFlow in a Bitwarden ViewModel test?
The skill says StateFlow replays the current state, so the first call is awaitItem(). EventFlow does not replay, so the test should call expectNoEvents() first.
Which base class should I extend for Bitwarden Compose tests?
The skill says to always extend BitwardenComposeTest for Compose screen tests. It pre-configures managers and wraps content in BitwardenTheme.
Why should assertCoroutineThrows not be wrapped in runTest?
The source says runTest catches exceptions and rethrows them, which breaks the assertion pattern. The assertion should be called directly.
How do I install testing-android-code?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is testing-android-code free?
The code is published under the GPL-3.0 licence. The service it connects to may have its own pricing.
Is testing-android-code safe to use?
It scores 88 of 100. Grades: maintenance A, licence C, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to testing-android-code?
Similar skills: openclaw-github-repo-commander, gradio, hig-components-menus, fastapi-templates.
