Agent skill

Android Test Batching

by nwjs in nwjs/chromium.src

Guide for auditing and applying batching annotations (@Batch) and AutoReset rules (AutoResetCtaTransitTestRule) to Android javatests in Chromium.

BSD-3-ClauseAuto-check passedMobile

Install Android Test Batching

skills CLI
$ npx skills add nwjs/chromium.src --skill android-test-batching -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install nwjs/chromium.src android-test-batching --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/nwjs/chromium.src.git skills-src && mkdir -p .claude/skills && cp -r skills-src/agents/skills/android-test-batching .claude/skills/android-test-batching && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
android-test-batching
GitHub stars
160
Token cost
~1.3k tokens
SKILL.md length
361 words
Files
2
Skills in repo
64
Repo updated
First seen
Licence
BSD-3-Clause

At a glance

Guide for auditing and applying batching annotations (@Batch) and AutoReset rules (AutoResetCtaTransitTestRule) to Android javatests in Chromium.

  • Works in 8 steps: Inspect Existing Annotations & Rules → Adding Annotations & Activity Rules → API Adaptations & Code Caveats → …
  • Optimizing Java instrumentation test runtimes
  • SKILL.md covers Core Invariants, Cleaning Up State Bleed Across… and Test Verification
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Android Test Batching is an agent skill from nwjs/chromium.src. Guide for auditing and applying batching annotations (@Batch) and AutoReset rules (AutoResetCtaTransitTestRule) to Android javatests in Chromium. Use this skill when optimizing Java instrumentation test runtimes, resolving test state leaks, or migrating tests to batched execution.

Its SKILL.md is about 1.3k tokens, which your agent loads only when the skill is triggered. The skill folder holds 1 other file.

It sits in Mobile. It works with Android and Java. The repository describes itself as: Chromium codebase with NW.js modifications. Based on https://chromium.googlesource.com/chromium/src.git. The licence is BSD-3-Clause.

When your agent uses it

  • Optimizing Java instrumentation test runtimes
  • Resolving test state leaks
  • Migrating tests to batched execution

Example prompts

  • “/android-test-batching”

Workflow steps

8 steps, taken from the step headings in SKILL.md.

  1. Inspect Existing Annotations & Rules
  2. Adding Annotations & Activity Rules
  3. API Adaptations & Code Caveats
  4. Finishing Stray Non-ChromeActivity Instances
  5. Clearing Snackbar Bleed
  6. Clearing Dialog Bleed
  7. Adding ForTesting() Reset Methods
  8. When to Use @DoNotBatch

What it can do on your machine

Read from SKILL.md and the folder at commit a9e8946. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are java and bash).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Android Test Batching loads about 1.3k tokens when it runs. Until then it costs about 76 tokens; SKILL.md has 361 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~76
When it runs · the whole SKILL.md, loaded when a task matches
~1.3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from nwjs/chromium.src at commit a9e8946, republished under its BSD-3-Clause licence (© nwjs). 361 words, ~1,304 tokens.

Download SKILL.mdSave it as .claude/skills/android-test-batching/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
android-test-batching
description
Guide for auditing and applying batching annotations (@Batch) and AutoReset rules (AutoResetCtaTransitTestRule) to Android javatests in Chromium. Use this skill when optimizing Java instrumentation test runtimes, resolving test state leaks, or migrating tests to batched execution.

Android Instrumentation Test Batching Guide

This skill provides step-by-step instructions for auditing, batching, and migrating Chromium Android instrumentation tests (javatests) to @Batch(Batch.PER_CLASS) and AutoResetCtaTransitTestRule.

Core Invariants

  1. AutoReset requires @Batch: AutoResetCtaTransitTestRule (ChromeTransitTestRules.fastAutoResetCtaActivityRule()) is only useful when @Batch annotations are present. Without @Batch, the Android test runner restarts the browser process between test methods anyway, rendering AutoReset ineffective.
  2. @Batch is useful independently of AutoReset: @Batch(Batch.PER_CLASS) avoids test runner restarts across test methods.
1. Inspect Existing Annotations & Rules
  • Check the test class for existing annotations:
    • If @DoNotBatch is present, inspect the documented reason before modifying.
    • If @Batch is already present, check if FreshCtaTransitTestRule can be upgraded to AutoResetCtaTransitTestRule.
2. Adding Annotations & Activity Rules
  • Add @Batch(Batch.PER_CLASS) to the class definition.

  • Prefer AutoResetCtaTransitTestRule over FreshCtaTransitTestRule for faster execution:

    java
    // Change:
    @Rule
    public FreshCtaTransitTestRule mActivityTestRule =
            ChromeTransitTestRules.freshChromeTabbedActivityRule();
    
    // To:
    @Rule
    public AutoResetCtaTransitTestRule mActivityTestRule =
            ChromeTransitTestRules.fastAutoResetCtaActivityRule();
3. API Adaptations & Code Caveats
  • startOnUrl vs startOnWebPage: FreshCtaTransitTestRule.startOnUrl(url) does not exist on AutoResetCtaTransitTestRule. Replace calls with mActivityTestRule.startOnWebPage(mTestServer.getURL(url)) or mActivityTestRule.startOnWebPage(url).
  • FreshCta-Specific Methods: Methods like skipWindowAndTabStateCleanup() in tearDown() are specific to FreshCtaTransitTestRule. Keep FreshCtaTransitTestRule if such cleanup overrides are required.

Cleaning Up State Bleed Across Batched Tests

State bleed across consecutive test methods in a batch can stem from various sources. Below are common, non-exhaustive examples and cleanup mechanisms to attempt before giving up or resorting to @DoNotBatch:

Show full SKILL.md (159 more words)Show less
1. Finishing Stray Non-ChromeActivity Instances

If secondary or settings activities launched during a test method linger into subsequent test runs:

java
ThreadUtils.runOnUiThreadBlocking(() -> {
    for (Activity activity : ApplicationStatus.getRunningActivities()) {
        if (!(activity instanceof ChromeTabbedActivity) && !activity.isFinishing()) {
            activity.finish();
        }
    }
});

Or use ApplicationTestUtils.finishActivity(activity).

2. Clearing Snackbar Bleed

If snackbars shown in one test method leak into subsequent tests:

java
ThreadUtils.runOnUiThreadBlocking(() -> {
    SnackbarManager snackbarManager = mSnackbarManagerSupplier.get();
    if (snackbarManager != null) {
        snackbarManager.dismissAllSnackbars();
    }
});
3. Clearing Dialog Bleed

If modal dialogs remain open across tests:

java
ThreadUtils.runOnUiThreadBlocking(() -> {
    ModalDialogManager modalDialogManager = mModalDialogManagerSupplier.get();
    if (modalDialogManager != null && modalDialogManager.isShowing()) {
        modalDialogManager.dismissAllDialogs(DialogDismissalCause.UNKNOWN);
    }
});
4. Adding ForTesting() Reset Methods

If production components or singletons retain state across test methods, add explicit reset methods to production or test helper classes:

java
// Example in production/helper component:
public static void resetForTesting() {
    sInstance = null;
    // Clear static observers or registered handlers
}

// Invoke in test @After or @Before:
@After
public void tearDown() {
    MySingletonComponent.resetForTesting();
}
5. When to Use @DoNotBatch

Only annotate with @DoNotBatch(reason = "<detailed reason>") if process-level state persists that cannot be easily reset via ForTesting() methods, cleanup utilities, or test rules.


Test Verification

Verify the batched test suite using autotest.py:

bash
./tools/autotest.py -C out/<build_dir> <filepath> --avd-config <avd_config_path>

[!TIP] Finding AVD Configs: It is strongly encouraged to pass --avd-config when running non-JUnit Android tests. Available emulator configurations can be found by inspecting the files in tools/android/avd/proto/ (e.g. tools/android/avd/proto/android_36_google_apis_x64.textpb). Ensure all test methods pass sequentially in a single run without hanging or failing due to state bleed.

© nwjs, BSD-3-Clause. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file in agents/skills/android-test-batching of nwjs/chromium.src.

  • SKILL.md
  • OWNERS

Open the folder on GitHubat commit a9e8946

Compare with similar skills

Android Test Batching next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Android Test Batching compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Android Test Batching this skillnwjs/chromium.src160—~1.3kAutomated safety check: PassBSD-3-Clause
Android API Diffgkd-kit/gkd43k—~796Automated safety check: PassGPL-3.0
Frb Android Emulator Preparefzyzcjy/flutter_rust_bridge5.4k—~2.1kAutomated safety check: NotesMIT
Android Maps Ktxgooglemaps/android-maps-ktx360—~897Automated safety check: PassApache-2.0
Android Audio E2Ehyochan/react-native-nitro-sound961—~814Automated safety check: PassMIT
Project Binding Adapter From SourceafkT/DevUtils1.6k—~1.6kAutomated safety check: PassApache-2.0

Similar skills

  • Android API Diff

    gkd-kit/gkd

    Looks up Android framework Java and AIDL APIs across versions with the android-api-diff CLI: signatures, availability, source files and hidden-API access code.

    43k GitHub stars~796 tokensUpdated yesterday
    MobileAuto-check passed
  • Frb Android Emulator Prepare

    fzyzcjy/flutter_rust_bridge

    A skill your agent uses when preparing, installing, diagnosing, or explaining the host Android Emulator environment for flutterrustbridge local runtime validation, including Android SDK command-line…

    5.4k GitHub stars~2.1k tokensUpdated today
    MobileAuto-check: notes
  • Android Maps Ktx

    googlemaps/android-maps-ktx

    Provides idiomatic Kotlin extension (KTX) patterns, reactive Flow event streams, and multi-subscriber shareIn rules for Google Maps SDK for Android and its Utility Library.

    360 GitHub stars~897 tokensUpdated today
    MobileAuto-check passed
  • Android Audio E2E

    hyochan/react-native-nitro-sound

    Build and run device-backed Android end-to-end checks for react-native-nitro-sound permissions, recording, playback, listeners, pause/resume, seek, speed, audio focus, lifecycle behavior, and rapid…

    961 GitHub stars~814 tokensUpdated 8 days ago
    MobileAuto-check passed
  • 根据用户给出的 Java/Kotlin 工具类或 View 相关源码,设计并实现 androidx.databinding.BindingAdapter。

    1.6k GitHub stars~1.6k tokensUpdated 1 mo ago
    MobileAuto-check passed
  • Dpis Hyperos Smoke

    Kwensiu/DPIS

    Run automated DPIS HyperOS device smoke tests for package-specific dp/font emulation or replacement.

    108 GitHub stars~715 tokensUpdated 2 days ago
    MobileAuto-check passed

More from nwjs/chromium.src

All 64 skills in this repo
  • Analyzing SQL Traces

    nwjs/chromium.src

    Extracts raw trace data from Perfetto traces, runs arbitrary SQL queries for custom follow-up analysis, and applies expert cognitive principles (Tiered Flow Analysis, Semantic Mismatch, Redundancy)…

    160 GitHub stars~2.9k tokensUpdated 4 days ago
    Auto-check passed
  • Autonomous multi-agent performance optimization loop for Chromium and V8.

    160 GitHub stars~4.2k tokensUpdated 4 days ago
    Auto-check passed
  • Automated Tracing

    nwjs/chromium.src

    Automated Tracing & Performance Telemetry in Chromium using Perfetto and Telemetry benchmarks.

    160 GitHub stars~1.5k tokensUpdated 4 days ago
    Auto-check passed
  • Chrome Releases

    nwjs/chromium.src

    Queries Chrome commit, version, release, and milestone metadata.

    160 GitHub stars~1.3k tokensUpdated 4 days ago
    Auto-check passed
  • Chromium Docs

    nwjs/chromium.src

    Search and reference Chromium documentation from the local docs index, including design docs, APIs, and development guides.

    160 GitHub stars~1.2k tokensUpdated 4 days ago
    Auto-check passed
  • Gn Deps Debugging

    nwjs/chromium.src

    Diagnose Chromium GN dependency and include-visibility failures, including BUILD.gn deps/publicdeps, DEPS include rules, private headers, and circular dependencies.

    160 GitHub stars~1.5k tokensUpdated 4 days ago
    Auto-check passed

Works with

Categories

Questions about Android Test Batching

What does Android Test Batching do?

Guide for auditing and applying batching annotations (@Batch) and AutoReset rules (AutoResetCtaTransitTestRule) to Android javatests in Chromium. src. Guide for auditing and applying batching annotations (@Batch) and AutoReset rules (AutoResetCtaTransitTestRule) to Android javatests in Chromium.

When should I use Android Test Batching?

Android Test Batching fits situations like: optimizing Java instrumentation test runtimes; resolving test state leaks; migrating tests to batched execution.

How do I install Android Test Batching in Claude Code?

Run `npx skills add nwjs/chromium.src --skill android-test-batching -a claude-code`. Or copy the skill folder (agents/skills/android-test-batching in nwjs/chromium.src) into .claude/skills/android-test-batching in your project. Claude Code loads it when a task matches its description.

How do I install Android Test Batching in Codex?

Run `npx skills add nwjs/chromium.src --skill android-test-batching -a codex`. Or copy the skill folder (agents/skills/android-test-batching in nwjs/chromium.src) into .agents/skills/android-test-batching in your project. Codex loads it when a task matches its description.

Can I use Android Test Batching in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add nwjs/chromium.src --skill android-test-batching -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/android-test-batching, .gemini/skills/android-test-batching, .github/skills/android-test-batching and .opencode/skills/android-test-batching in your project.

What does Android Test Batching need to run?

SKILL.md names no scripts, command-line tools or credentials: Android Test Batching is instructions for the agent only.

Does Android Test Batching access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Android Test Batching safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Android Test Batching use?

Android Test Batching is published under the BSD-3-Clause licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Android Test Batching use?

About 1.3k tokens (SKILL.md is roughly 5.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Android Test Batching?

Skills that share tags, products or a category with Android Test Batching: Android API Diff (gkd-kit/gkd, 43k stars), Frb Android Emulator Prepare (fzyzcjy/flutter_rust_bridge, 5.4k stars), Android Maps Ktx (googlemaps/android-maps-ktx, 360 stars) and Android Audio E2E (hyochan/react-native-nitro-sound, 961 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Android Test Batching?

nwjs (a GitHub organization) maintains it in nwjs/chromium.src, which has 160 GitHub stars. The repository holds 64 skills in this directory. The repository was last updated on October 3, 2026.

Source: nwjs/chromium.src on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.