Covers the full Kotlin testing stack with Kotest spec styles, MockK for mocking, coroutine testing, and Kover coverage configuration. Includes a proper TDD walkthrough showing the RED-GREEN-REFACTOR cycle with a real email validator example, which is rare to see documented this clearly. The spec style comparisons (StringSpec, FunSpec, BehaviorSpec, DescribeSpec) are useful if you're picking a testing DSL for your team. Kotest matchers section gives you the common assertions without digging through docs. This is opinionated toward idiomatic Kotlin testing rather than JUnit, so expect property-based testing patterns and coroutine-aware mocks. The Ktor testApplication section suggests it's aimed at backend services, not Android.

skills.sh installs
4.8K
GitHub stars
229.1K
last updated
Jul 14, 2026

Install

$ npx -y skills add affaan-m/everything-claude-code --skill kotlin-testing --agent claude-code

Installs into .claude/skills of the current project.

Files

Kotlin Testing Patterns

Comprehensive Kotlin testing patterns for writing reliable, maintainable tests following TDD methodology with Kotest and MockK.

When to Use

  • Writing new Kotlin functions or classes
  • Adding test coverage to existing Kotlin code
  • Implementing property-based tests
  • Following TDD workflow in Kotlin projects
  • Configuring Kover for code coverage

How It Works

  1. Identify target code — Find the function, class, or module to test
  2. Write a Kotest spec — Choose a spec style (StringSpec, FunSpec, BehaviorSpec) matching the test scope
  3. Mock dependencies — Use MockK to isolate the unit under test
  4. Run tests (RED) — Verify the test fails with the expected error
  5. Implement code (GREEN) — Write minimal code to pass the test
  6. Refactor — Improve the implementation while keeping tests green
  7. Check coverage — Run ./gradlew koverHtmlReport and verify 80%+ coverage

Examples

The following sections contain detailed, runnable examples for each testing pattern:

Quick Reference

Sponsors

Details

Repository
github.com/affaan-m/everything-claude-code
Categories
Testing & QA, Mobile Development, Java & JVM
First seen
Apr 16, 2026

More from affaan-m/everything-claude-code

All 256
1affaan-m avatarperl-testingaffaan-m/everything-claude-codeperl testing4.5Kskills.sh installs
2affaan-m avatarbrowser-qaaffaan-m/everything-claude-codebrowser qa4.3Kskills.sh installs
3affaan-m avatarcsharp-testingaffaan-m/everything-claude-codecsharp testing3.6Kskills.sh installs
4sickn33 avatarplaywright-skillsickn33/antigravity-awesome-skillsplaywright skill3.5Kskills.sh installs
5everyinc avatarce-test-xcodeeveryinc/compound-engineering-pluginBuild and test iOS apps on simulator with XcodeBuildMCP.3Kskills.sh installs
6remotion-dev avatarweb-renderer-testremotion-dev/remotionAdd a test case to the web renderer2.9Kskills.sh installs