
Kotlin Testing
Covers the full TDD cycle in Kotlin with Kotest specs, MockK mocking, coroutine testing, and Kover coverage reporting. You get working examples of StringSpec, FunSpec, BehaviorSpec, and DescribeSpec styles, plus a proper RED-GREEN-REFACTOR walkthrough with an email validator. The matchers section is solid for assertions, and the MockK examples show coEvery for suspending functions and verification patterns. Includes Ktor testApplication setup if you're testing HTTP routes. The 80% coverage target with Kover is reasonable, and the examples are copy-paste ready. Good reference if you want idiomatic Kotlin tests instead of fighting with JUnit patterns that don't fit the language.
- skills.sh installs
- 5.7K
- GitHub stars
- 300.3K
- last updated
- Aug 21, 2026
Install
$ npx -y skills add affaan-m/ecc --skill kotlin-testing --agent claude-codeInstalls 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
- Identify target code — Find the function, class, or module to test
- Write a Kotest spec — Choose a spec style (StringSpec, FunSpec, BehaviorSpec) matching the test scope
- Mock dependencies — Use MockK to isolate the unit under test
- Run tests (RED) — Verify the test fails with the expected error
- Implement code (GREEN) — Write minimal code to pass the test
- Refactor — Improve the implementation while keeping tests green
- Check coverage — Run
./gradlew koverHtmlReportand verify 80%+ coverage
Examples
The following sections contain detailed, runnable examples for each testing pattern:
Quick Reference
Sponsors
Details
- Repository
- github.com/affaan-m/ecc
- Categories
- Testing & QA, Mobile Development, Java & JVM
- First seen
- Jul 14, 2026
More from affaan-m/ecc
All 263- Ai Regression Testing5.7K
- Dart Flutter Patterns5.7K
- Mysql Patterns5.7K
- Production Audit5.7K
- Documentation Lookup5.7K
- Make Interfaces Feel Better5.7K
- Windows Desktop E2e5.7K
- Motion Advanced5.6K
- Cost Aware Llm Pipeline5.6K
- Mcp Server Patterns5.6K
- Council5.6K
- Fal Ai Media5.6K
- Jpa Patterns5.6K
- Mle Workflow5.6K
- Compose Multiplatform Patterns5.6K
- Llm Trading Agent Security5.6K
- Swiftui Patterns5.6K
- Github Ops5.6K
- Autonomous Loops5.6K
- Data Scraper Agent5.6K
- Springboot Verification5.6K
- Django Verification5.6K
- Django Celery5.6K
- Dotnet Patterns5.6K