Skip to content
affaan-m avatar

Kotlin Testing

Kotest, MockK, and Kover testing patterns that follow TDD, with runnable examples for each spec style.

CCM score
69 of 100
skills.sh installs
12.1K
GitHub stars
312.6K
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers the RED-GREEN-REFACTOR cycle with a worked EmailValidator example from failing test to passing code
  • Includes Kotest spec styles (StringSpec, FunSpec, BehaviorSpec, DescribeSpec), MockK setup, and Kotest matchers
  • Explains coroutine mocking, argument capture, and Ktor testApplication setup for HTTP endpoint tests
  • Designed for Kotlin projects that need 80%+ coverage measured with ./gradlew koverHtmlReport

Install

$ npx -y skills add affaan-m/ecc --skill kotlin-testing -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

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

Details

Repository
github.com/affaan-m/ecc
Categories
Testing & QA, Java & JVM
First seen
Jul 14, 2026

Questions

What does the kotlin-testing skill help with?

The kotlin-testing skill provides Kotlin testing patterns using Kotest, MockK, coroutine testing, property-based testing, and Kover coverage. It follows a TDD workflow with a red, green, refactor cycle and checks coverage with Kover.

How do I install the kotlin-testing skill?

Run npx -y skills add affaan-m/ecc --skill kotlin-testing -y in your project. This lets the agent write Kotlin tests with Kotest and MockK, and check coverage with ./gradlew koverHtmlReport.

Which other skills are in the Testing & QA category?

kotlin-testing ranks in the top 50 of the Testing & QA category on Claude Marketplaces. Other skills in this category include tdd, migrate-to-shoehorn, test-driven-development, webapp-testing and break-ui.

Who is kotlin-testing for?

It is for developers writing Kotlin tests with Kotest or MockK, testing coroutines, or following TDD in Kotlin projects. It also covers adding test coverage to existing Kotlin code and configuring Kover.

More from affaan-m/ecc

All 257

Similar to Kotlin Testing

More Testing & QA