android-test-structure
Create androidTest directory structure with base classes and utilities
Best use case
android-test-structure is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Create androidTest directory structure with base classes and utilities
Teams using android-test-structure should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/android-test-structure/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How android-test-structure Compares
| Feature / Agent | android-test-structure | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Create androidTest directory structure with base classes and utilities
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Android Test Structure
Creates androidTest directory structure with base test class and utilities for Espresso testing.
## Prerequisites
- Android project with Gradle
- Espresso dependencies added (run `android-espresso-dependencies` first)
- Package name known
## Inputs
| Input | Required | Default | Description |
|-------|----------|---------|-------------|
| project_path | Yes | . | Android project root |
| package_name | Yes | - | App package (e.g., com.example.app) |
## Process
### Step 1: Create Directory Structure
```bash
# Get package path from package name (com.example.app -> com/example/app)
PACKAGE_PATH=$(echo "${PACKAGE_NAME}" | tr '.' '/')
# Create androidTest directories
mkdir -p "app/src/androidTest/kotlin/${PACKAGE_PATH}/base"
mkdir -p "app/src/androidTest/kotlin/${PACKAGE_PATH}/utils"
mkdir -p "app/src/androidTest/kotlin/${PACKAGE_PATH}/screens"
```
### Step 2: Create BaseTest.kt
Create `app/src/androidTest/kotlin/${PACKAGE_PATH}/base/BaseTest.kt`:
```kotlin
package ${PACKAGE_NAME}.base
import android.content.Context
import androidx.test.core.app.ApplicationProvider
import androidx.test.ext.junit.rules.ActivityScenarioRule
import org.junit.After
import org.junit.Before
import org.junit.Rule
/**
* Base class for all instrumented tests.
* Provides common setup, teardown, and utilities.
*/
abstract class BaseTest {
protected val context: Context = ApplicationProvider.getApplicationContext()
@Before
open fun setUp() {
// Common setup for all tests
// Override in subclasses for specific setup
}
@After
open fun tearDown() {
// Common cleanup
// Override in subclasses for specific cleanup
}
/**
* Wait for idle state before proceeding
*/
protected fun waitForIdle() {
androidx.test.espresso.Espresso.onIdle()
}
}
```
### Step 3: Create TestUtils.kt
Create `app/src/androidTest/kotlin/${PACKAGE_PATH}/utils/TestUtils.kt`:
```kotlin
package ${PACKAGE_NAME}.utils
import android.view.View
import androidx.recyclerview.widget.RecyclerView
import androidx.test.espresso.UiController
import androidx.test.espresso.ViewAction
import androidx.test.espresso.matcher.ViewMatchers.isAssignableFrom
import org.hamcrest.Matcher
object TestUtils {
/**
* Custom action to get RecyclerView item count
*/
fun getRecyclerViewItemCount(recyclerView: RecyclerView): Int {
return recyclerView.adapter?.itemCount ?: 0
}
/**
* Wait for a condition with timeout
*/
fun waitForCondition(
timeoutMs: Long = 5000,
condition: () -> Boolean
): Boolean {
val startTime = System.currentTimeMillis()
while (System.currentTimeMillis() - startTime < timeoutMs) {
if (condition()) return true
Thread.sleep(100)
}
return false
}
/**
* Custom ViewAction to perform click on specific position
*/
fun clickOnViewChild(viewId: Int): ViewAction {
return object : ViewAction {
override fun getConstraints(): Matcher<View>? {
return null
}
override fun getDescription(): String {
return "Click on a child view with specified id."
}
override fun perform(uiController: UiController, view: View) {
val v = view.findViewById<View>(viewId)
v.performClick()
}
}
}
}
```
### Step 4: Create README for Tests
Create `app/src/androidTest/README.md`:
```markdown
# Android E2E Tests
This directory contains end-to-end UI tests using Espresso.
## Structure
- `base/` - Base classes for all tests
- `utils/` - Test utilities and helpers
- `screens/` - Screen-specific test classes
## Running Tests
```bash
# All tests
./gradlew connectedAndroidTest
# Specific test class
./gradlew connectedAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=com.example.app.screens.MainActivityTest
```
## Writing Tests
1. Extend `BaseTest` for common setup
2. Use utilities from `TestUtils`
3. Follow AAA pattern: Arrange, Act, Assert
```
## Verification
**MANDATORY:** Run these commands:
```bash
# Verify directory structure exists
test -d app/src/androidTest && echo "✓ androidTest directory created"
# Verify base classes exist
test -f app/src/androidTest/kotlin/*/base/BaseTest.kt && echo "✓ BaseTest.kt created"
# Verify utils exist
test -f app/src/androidTest/kotlin/*/utils/TestUtils.kt && echo "✓ TestUtils.kt created"
```
**Expected output:**
- ✓ androidTest directory created
- ✓ BaseTest.kt created
- ✓ TestUtils.kt created
## Outputs
| Output | Location | Description |
|--------|----------|-------------|
| Directory structure | app/src/androidTest/ | Test source directory |
| BaseTest class | base/BaseTest.kt | Common test setup |
| Test utilities | utils/TestUtils.kt | Helper functions |
| README | README.md | Test documentation |
## Troubleshooting
### "Package path incorrect"
**Cause:** Package name format wrong
**Fix:** Use format: com.example.app (not path format)
### "Directory already exists"
**Cause:** androidTest directory already created
**Fix:** Merge with existing structure, don't overwrite
## Completion Criteria
- [ ] `app/src/androidTest/` directory exists
- [ ] `base/BaseTest.kt` exists
- [ ] `utils/TestUtils.kt` exists
- [ ] `screens/` directory exists
- [ ] README.md createdRelated Skills
Burp Suite Web Application Testing
This skill should be used when the user asks to "intercept HTTP traffic", "modify web requests", "use Burp Suite for testing", "perform web vulnerability scanning", "test with Burp Repeater", "analyze HTTP history", or "configure proxy for web testing". It provides comprehensive guidance for using Burp Suite's core features for web application security testing.
burp-suite-testing
This skill should be used when the user asks to "intercept HTTP traffic", "modify web requests", "use Burp Suite for testing", "perform web vulnerability scanning", "test with Burp ...
backtesting-frameworks
Build robust backtesting systems for trading strategies with proper handling of look-ahead bias, survivorship bias, and transaction costs. Use when developing trading algorithms, validating strateg...
axiom-ios-testing
Use when writing ANY test, debugging flaky tests, making tests faster, or asking about Swift Testing vs XCTest. Covers unit tests, UI tests, fast tests without simulator, async testing, test architecture.
asyncredux-testing-view-models
Test StoreConnector view-models in isolation. Covers creating view-models with `Vm.createFrom()`, testing view-model properties, testing callbacks that dispatch actions, and verifying state changes from callbacks.
asyncredux-testing-basics
Write unit tests for AsyncRedux actions using the Store directly. Covers creating test stores with initial state, using `dispatchAndWait()`, checking state after actions, verifying action errors via ActionStatus, and testing async actions.
astro-testing
Testing and QA gate for Astro lead gen sites. Manual + E2E + A11y + Performance. FAIL = no deploy.
aspire-integration-testing
Write integration tests using .NET Aspire's testing facilities with xUnit. Covers test fixtures, distributed application setup, endpoint discovery, and patterns for testing ASP.NET Core apps with real dependencies.
ark-dashboard-testing
Test Ark Dashboard with Playwright and create PRs with screenshots. Use when testing dashboard UI, taking screenshots for PRs, or reviewing dashboard changes.
Ark Dashboard Test
Test the Ark Dashboard UI with Playwright
arguments-test
Test skill for argument substitution
app-comprehensive-test-generator
Generate exhaustive user-flow and edge-case test scenarios from an app's codebase, produce scenario .md files, execute tests using connected or newly created MCPs, and produce an app.qa.report.md summarizing failures and suggested fixes.