Agent skill

Android Unit Test

by nwjs in nwjs/chromium.src

Guide for writing and converting Chromium Android unit tests across host Robolectric (chromejunittests) and on-device (chromepublicunittestapk) suites.

BSD-3-ClauseAuto-check passedTesting & QA

Install Android Unit Test

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

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

GitHub CLI
$ gh skill install nwjs/chromium.src android-unit-test --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-unit-test .claude/skills/android-unit-test && 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-unit-test
GitHub stars
160
Token cost
~1.8k tokens
SKILL.md length
446 words
Files
2
Skills in repo
64
Repo updated
First seen
Licence
BSD-3-Clause

At a glance

Guide for writing and converting Chromium Android unit tests across host Robolectric (chromejunittests) and on-device (chromepublicunittestapk) suites.

  • Works in 4 steps: Test Tier Hierarchy & Choosing the Right… → Key Rules for Converting & Migrating Tests → Step-by-Step Conversion Workflows → …
  • Tasks that involve Unit testing
  • SKILL.md covers 1. Test Tier Hierarchy &…, 2. Key Rules for Converting &…, 3. Step-by-Step Conversion… and 4. Compilation & Execution…
  • Calls git

What it does

Android Unit Test is an agent skill from nwjs/chromium.src. Guide for writing and converting Chromium Android unit tests across host Robolectric (chromejunittests) and on-device (chromepublicunittestapk) suites.

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

It sits in Testing & QA, covering Unit testing. It works with Android, JUnit 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

  • Tasks that involve Unit testing

Example prompts

  • “/android-unit-test”

Workflow steps

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

  1. Test Tier Hierarchy & Choosing the Right Suite
  2. Key Rules for Converting & Migrating Tests
  3. Step-by-Step Conversion Workflows
  4. Compilation & Execution Workflow

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

    Shell commands in SKILL.md call:

    • git

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

  • Network

    No URLs in SKILL.md. Its commands use git, which can reach the network depending on how they are called.

    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 Unit Test loads about 1.8k tokens when it runs. Until then it costs about 44 tokens; SKILL.md has 446 words of instructions outside code blocks.

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

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). 446 words, ~1,797 tokens.

Download SKILL.mdSave it as .claude/skills/android-unit-test/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
android-unit-test
description
Guide for writing and converting Chromium Android unit tests across host Robolectric (chrome_junit_tests) and on-device (chrome_public_unit_test_apk) suites.

Android Unit Testing Guide

This skill provides comprehensive guidance on choosing, writing, running, and migrating Android test cases across Chromium's three major Java test tiers (chrome_junit_tests, chrome_public_unit_test_apk, and chrome_public_test_apk).

1. Test Tier Hierarchy & Choosing the Right Suite

When writing or refactoring Android Java tests in Chromium, always aim for the lightest, fastest test tier that satisfies the requirements of the code being tested:

Target SuiteExecution EnvironmentBest ForKey Constraints & Rules
chrome_junit_tests (junit/)Host JVM via Robolectric (BaseRobolectricTestRunner)Pure Java utility methods, data structures, MVC/MVC mediators (*MediatorUnitTest.java), presenter logic, string manipulation, and mock-based testing.Fastest execution. No actual hardware/emulator required. Cannot execute real native NDK code or live browser profiles without shadow structures or stubs.
chrome_public_unit_test_apk (unit_device_javatests)Device / Emulator (BaseJUnit4ClassRunner + @Batch(Batch.UNIT_TESTS))Unit tests requiring actual Android device features (such as PackageManager checks, real layout inflating/rendering with BlankUiTestActivity, or localized JNI helper methods like CurrencyFormatter).Configured with is_unit_test = true: any attempts to initialize the main browser process or start ChromeTabbedActivity will explicitly fail.
chrome_public_test_apk (javatests/)Device / Emulator Instrumentation (ChromeTabbedActivityTestRule, BaseJUnit4ClassRunner)Full end-to-end multi-component browser profile initialization, web page interactions (startOnWebPage, embeddedTestServer), and complex UI flows across Activities.Heaviest and slowest tier. Should be reserved exclusively for full browser activity & integration flows.

2. Key Rules for Converting & Migrating Tests

When converting instrumentation tests from chrome_public_test_apk (javatests/) to host unit tests (chrome_junit_tests / junit/) or on-device unit tests (chrome_public_unit_test_apk), follow these key rules:

  1. No @Batch in chrome_junit_tests: Robolectric host unit tests on the JVM are naturally batched by default; do NOT add @Batch annotations to tests under junit/.
  2. No @UiThreadTest in chrome_junit_tests: Robolectric tests execute on the main looper thread automatically. Strip import androidx.test.annotation.UiThreadTest; and method-level @UiThreadTest annotations completely when converting to chrome_junit_tests.
  3. Native Code Dependencies: If a unit test uses real NDK native methods (such as CurrencyFormatter in PriceUtils.formatPrice) that cannot be mocked, place it in chrome_public_unit_test_apk (unit_device_javatests) instead of chrome_junit_tests.

Show full SKILL.md (165 more words)Show less

3. Step-by-Step Conversion Workflows

Converting to Host Unit Tests (chrome_junit_tests)
  1. File Location: Move the file from javatests/src/... to junit/src/... via git mv.
  2. Test Runner: Replace @RunWith(BaseJUnit4ClassRunner.class) or ChromeJUnit4ClassRunner with:
    java
    import org.chromium.base.test.BaseRobolectricTestRunner;
    
    @RunWith(BaseRobolectricTestRunner.class)
  3. Clean Up Annotations: Remove @Batch(...) and @UiThreadTest.
  4. Simplify Threading & Mocks: Replace complex calls like ThreadUtils.runOnUiThreadBlocking(() -> Mockito.mock(...)) with direct Mockito initialization: Mockito.mock(...).
  5. Update BUILD.gn: Move the test source out of the javatests target into a robolectric_library("junit") target:
    gn
    robolectric_library("junit") {
      testonly = true
      sources = [
        "junit/src/org/chromium/chrome/browser/mycomponent/MyComponentUnitTest.java",
      ]
      deps = [
        ":java",
        "//base:base_java_test_support",
        "//base:base_junit_test_support",
        "//third_party/androidx:androidx_test_runner_java",
        "//third_party/junit",
        "//third_party/mockito:mockito_java",
      ]
    }
Converting to On-Device Unit Tests (chrome_public_unit_test_apk)
  • Runner & Annotations: Keep @RunWith(BaseJUnit4ClassRunner.class) along with @Batch(Batch.UNIT_TESTS) or @Batch(Batch.PER_CLASS).
  • Target Setup in BUILD.gn: Define a dedicated unit_device_javatests target within your component and register it inside chrome_public_unit_test_apk (//chrome/android/BUILD.gn):
    gn
    android_library("unit_device_javatests") {
      testonly = true
      resources_package = "org.chromium.chrome.browser.mycomponent"
      sources = [ "javatests/src/org/chromium/chrome/browser/mycomponent/MyComponentDeviceUnitTest.java" ]
      deps = [
        ":java",
        "//base:base_java",
        "//base:base_java_test_support",
        "//third_party/androidx:androidx_test_runner_java",
        "//third_party/junit",
      ]
    }

4. Compilation & Execution Workflow

Before running tests locally, always compile the specific target first.

Host JVM Tests (chrome_junit_tests)
bash
autoninja -C out/Debug chrome_junit_tests && \
out/Debug/bin/run_chrome_junit_tests -f "*MyComponentUnitTest*"
On-Device Unit Tests (chrome_public_unit_test_apk)

Always specify your emulator or device explicitly with -d:

bash
autoninja -C out/Debug chrome_public_unit_test_apk && \
out/Debug/bin/run_chrome_public_unit_test_apk -f "*MyComponentDeviceUnitTest*" -d emulator-5554

© 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-unit-test of nwjs/chromium.src.

  • SKILL.md
  • OWNERS

Open the folder on GitHubat commit a9e8946

Compare with similar skills

Android Unit Test 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 Unit Test compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Android Unit Test this skillnwjs/chromium.src160—~1.8kAutomated safety check: PassBSD-3-Clause
Add Library Testosama-raddad/FireCrasher147—~612Automated safety check: PassApache-2.0
Debug Surefireeclipse-rdf4j/rdf4j420—~2.4kAutomated safety check: PassBSD-3-Clause
Minecraft TestingJahrome907/minecraft-agent-skills166—~3.8kAutomated safety check: PassMIT
Eclipse Testgradusnikov/eclipse-chatgpt-plugin171—~1kAutomated safety check: PassMIT
Unit TestingLeavesfly/Jimi237—~667Automated safety check: PassNone

Similar skills

  • Add Library Test

    osama-raddad/FireCrasher

    Add or update a Robolectric JVM unit test for the FireCrasher library.

    147 GitHub stars~612 tokensUpdated 3 mo ago
    Testing & QAAuto-check passed
  • Debug Surefire

    eclipse-rdf4j/rdf4j

    Debug Maven Surefire unit tests by running them in JDWP "wait for debugger" mode (-Dmaven.surefire.debug) and attaching to the forked test JVM using jdb (preferred for CLI/agent debugging)…

    420 GitHub stars~2.4k tokensUpdated today
    Testing & QAAuto-check passed
  • Minecraft Testing

    Jahrome907/minecraft-agent-skills

    Design and implement automated tests for current Minecraft 26.x or legacy 1.21.x mods and plugins using JUnit, MockBukkit, NeoForge Game Tests, or Fabric Game Tests.

    166 GitHub stars~3.8k tokensUpdated 24 days ago
    Testing & QAAuto-check passed
  • Eclipse Test

    gradusnikov/eclipse-chatgpt-plugin

    Run JUnit tests in Eclipse projects — all tests, by package, by class, or individual test methods.

    171 GitHub stars~1k tokensUpdated 10 days ago
    Testing & QAAuto-check passed
  • Unit Testing

    Leavesfly/Jimi

    Java单元测试编写指南(基于JUnit和Mockito)

    237 GitHub stars~667 tokensUpdated 1 mo ago
    Testing & QAAuto-check passed
  • Official

    Convert JUnit 5 @MethodSource/@CsvSource/@ValueSource parameterized tests to @TableTest (JDK8)

    736 GitHub stars~950 tokensUpdated today
    Testing & QAAuto-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

Categories

Questions about Android Unit Test

What does Android Unit Test do?

Guide for writing and converting Chromium Android unit tests across host Robolectric (chromejunittests) and on-device (chromepublicunittestapk) suites. src. Guide for writing and converting Chromium Android unit tests across host Robolectric (chromejunittests) and on-device (chromepublicunittestapk) suites.

When should I use Android Unit Test?

Android Unit Test fits situations like: tasks that involve Unit testing.

How do I install Android Unit Test in Claude Code?

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

How do I install Android Unit Test in Codex?

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

Can I use Android Unit Test 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-unit-test -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-unit-test, .gemini/skills/android-unit-test, .github/skills/android-unit-test and .opencode/skills/android-unit-test in your project.

What does Android Unit Test need to run?

Going by SKILL.md and its folder, Android Unit Test needs the command-line tools its instructions call (git).

Does Android Unit Test access the network?

SKILL.md contains no URLs. Its commands use git, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Android Unit Test 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 Unit Test use?

Android Unit Test 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 Unit Test use?

About 1.8k tokens (SKILL.md is roughly 7.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 Unit Test?

Skills that share tags, products or a category with Android Unit Test: Add Library Test (osama-raddad/FireCrasher, 147 stars), Debug Surefire (eclipse-rdf4j/rdf4j, 420 stars), Minecraft Testing (Jahrome907/minecraft-agent-skills, 166 stars) and Eclipse Test (gradusnikov/eclipse-chatgpt-plugin, 171 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Android Unit Test?

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.