Testing
The tests { } block inside kreate { project { } } provides a unified, opinionated testing configuration for both Kotlin JVM and Kotlin Multiplatform projects. When enabled, Kreate automatically configures all test tasks with sensible defaults for parallelism, timeouts, failure handling, console logging, and report generation — without requiring manual tasks.withType<Test> boilerplate.
Testing is disabled by default. Enable it with:
Test Framework
Kreate uses the JUnit Platform as the test engine for JVM targets. No additional useJUnitPlatform() call is needed — Kreate wires this automatically on all Test tasks when the Kotlin JVM plugin is present.
What Kreate Configures
When enabled is true, Kreate applies the following to every matching test task:
Setting | Applied to | Description |
|---|---|---|
| JVM | Enables the JUnit Platform test engine |
| All tasks | Sets the per-task execution timeout |
| All tasks | Controls whether the build continues after failures |
| All tasks | Fails the build if no tests are found |
| All tasks | Controls Gradle's incremental skip logic |
| JVM | Sets parallel test process count |
| All tasks | Configures console event output and exception format |
| All tasks | Enables or disables XML / HTML reports |
For Kotlin Multiplatform projects, both Test tasks (JVM target) and KotlinTest tasks (native/JS targets) are configured independently.
Next Steps
Configuration Reference: Detailed DSL options for parallelism and logging
Kotlin Multiplatform Testing: Platform-specific considerations for KMP
Examples: Practical testing scenarios and configurations