writing-tests-with-kotlin-test

writing-tests-with-kotlin-test is a skill for Claude Code, Codex from skydoves/android-testing-skills. It costs 285 tokens per session (4,479 once invoked), scanned A, original, Apache-2.0.

A guide to writing Kotlin tests with the kotlin.test library, which provides shared test annotations and checks for Kotlin projects that run on platforms such as the JVM, Android, JavaScript, Native, and WebAssembly.

In plain words
What is it for?
Use it to add test cases, setup and cleanup steps, exception checks, collection comparisons, type checks, and Gradle configuration for Kotlin Multiplatform tests.
Why use it?
It helps avoid writing separate test code for each platform and provides a common alternative when JVM-only JUnit imports cannot be used in shared Kotlin code.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to add test cases, setup and cleanup steps, exception checks, collection comparisons, type checks, and Gradle configuration for Kotlin Multiplatform tests.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/skydoves/android-testing-skills/writing-tests-with-kotlin-test
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add skydoves/android-testing-skills --skill writing-tests-with-kotlin-test
Clone the repo
git clone --depth 1 https://github.com/skydoves/android-testing-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for writing-tests-with-kotlin-test

README.md
[![agentmods](https://agentmods.dev/badge/skills/skydoves/android-testing-skills/writing-tests-with-kotlin-test/github.svg)](https://agentmods.dev/skills/skydoves/android-testing-skills/writing-tests-with-kotlin-test)
Your own site
<a href="https://agentmods.dev/skills/skydoves/android-testing-skills/writing-tests-with-kotlin-test"><img src="https://agentmods.dev/badge/skills/skydoves/android-testing-skills/writing-tests-with-kotlin-test/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for writing-tests-with-kotlin-test

Your own site · 80×15
<a href="https://agentmods.dev/skills/skydoves/android-testing-skills/writing-tests-with-kotlin-test"><img src="https://agentmods.dev/badge/skills/skydoves/android-testing-skills/writing-tests-with-kotlin-test.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 285 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,479 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00285 $0.04479
Opus 5 $0.00143 $0.02240
Sonnet 5 $0.00057 $0.00896
Haiku 4.5 $0.00028 $0.00448

Measured 10d ago against content hash cfe88ca89ff7, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

writing-tests-with-kotlin-test scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

kotlin/kotlin-test/writing-tests-with-kotlin-test/SKILL.md · 213 lines

How it starts

The opening of the file, as written. The whole thing — 213 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Writing Tests With kotlin.test — One Assertion API Across Every Target

kotlin.test is Kotlin's own thin test library: framework-agnostic assert* functions plus @Test/@BeforeTest/@AfterTest annotations that typealias onto whatever runner is on the classpath (JUnit4, JUnit5, TestNG, the JS/Native runners). Write import kotlin.test.* once and the same test source compiles in commonTest, on the JVM, and on every Kotlin Multiplatform target. This skill covers the API surface, the @OnlyInputTypes compile-time guard, the Asserter extension point, and the Gradle wiring. It is the assertion layer; the runner layer for Android instrumentation is ../../../jvm-tests/runner/configuring-junit4-on-android/SKILL.md.

When to use this skill

  • The module is Kotlin Multiplatform and tests live in commonTest — JUnit's org.junit.* is not available there; kotlin.test is.
  • The user wants one assertion vocabulary that reads the same on JVM, Android, JS, and Native.
  • The user reaches for assertFailsWith<IllegalStateException> { … }, assertContentEquals(...), assertIs<Foo>(value), assertContains(list, x), expect(3) { compute() }, or @BeforeTest/@AfterTest.
  • A JVM module has testImplementation(kotlin("test")) and the test "runs on JUnit but I never added JUnit" — explaining the capability-based resolution.
  • kotlin.test.assertEquals failures render as a plain AssertionError with no diff, and the user wants the JUnit-style comparison failure back.

When NOT to use this skill

  • The user wants rich fluent assertions (assertThat(x).isEqualTo(...), soft assertions, collection matchers) — that is AssertJ / Google Truth / Kotest assertions, deliberately out of kotlin.test's minimal scope.
  • The user is writing an Android instrumentation test and asking about the runner (@RunWith(AndroidJUnit4::class), AndroidJUnitRunner, androidx.test:*) — use ../../../jvm-tests/runner/configuring-junit4-on-android/SKILL.md and ../../../instrumentation/runner/running-instrumented-tests-with-androidjunit4/SKILL.md. (You can still use kotlin.test assertions inside those tests.)
  • The user is testing coroutines / FlowrunTest, TestScope, Dispatchers.setMain is ../../../jvm-tests/coroutines/testing-coroutines-with-runtest/SKILL.md; Turbine is ../../../jvm-tests/coroutines/testing-flows-with-turbine/SKILL.md. (kotlin.test supplies the assert* calls inside those.)
  • The user wants Compose UI assertions (assertIsDisplayed, assertTextEquals) — that is the compose/assertions/ skills, unrelated to kotlin.test.

Read the full file on GitHub · 213 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 10d ago First seen · 213 lines · 285 tokens per session scan A cfe88ca89ff7

Subscribe to this mod's changes

writing-tests-with-kotlin-test is a skill published in the GitHub repository skydoves/android-testing-skills (319 stars, last pushed 3mo ago), licensed Apache-2.0. It adds 285 tokens to every session and 4,479 once invoked, about $0.0014 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories