
Enhances command-line application testing by offering a DSL for streamlined assertion writing and console interaction, simplifying setup without manual environment handling or exception catching.
Test your Clikt cli with a convenient extension function:
class Greeter : CliktCommand() {
override fun run() {
val name = prompt("Enter your name")
echo("Hello $name!")
}
}
Greeter().test {
expectOutput("Enter your name: ")
provideInput("Tester")
expectOutput("Hello Tester!")
}Clikt Testkit provides a testing dsl for the Clikt command line parser library. Compared to testing with vanilla Clikt, you benefit from
.test{} on the command you want to test and start writing assertions.
No .parse(), catching ProgramResult or overwriting the context to set environment variables.Clikt Testkit is published through Maven Central. You can include it in your Gradle project by adding this dependency:
dependencies {
implementation("com.wolpl.clikt-testkit:clikt-testkit:1.0.0")
}For instructions how to implement tests, please refer to the Clikt Testkit documentation.
Clikt Testkit is a Kotlin Multiplatform library, currently supporting these targets:
Test your Clikt cli with a convenient extension function:
class Greeter : CliktCommand() {
override fun run() {
val name = prompt("Enter your name")
echo("Hello $name!")
}
}
Greeter().test {
expectOutput("Enter your name: ")
provideInput("Tester")
expectOutput("Hello Tester!")
}Clikt Testkit provides a testing dsl for the Clikt command line parser library. Compared to testing with vanilla Clikt, you benefit from
.test{} on the command you want to test and start writing assertions.
No .parse(), catching ProgramResult or overwriting the context to set environment variables.Clikt Testkit is published through Maven Central. You can include it in your Gradle project by adding this dependency:
dependencies {
implementation("com.wolpl.clikt-testkit:clikt-testkit:1.0.0")
}For instructions how to implement tests, please refer to the Clikt Testkit documentation.
Clikt Testkit is a Kotlin Multiplatform library, currently supporting these targets: