Best Kotest code snippet using io.kotest.engine.config.dump
KotestEngineLauncher.kt
Source:KotestEngineLauncher.kt
...68 tags = tags,69 scripts = scripts,70 )71 @Deprecated("This class is deprecated since 5.0")72 fun withDumpConfig(dump: Boolean) = KotestEngineLauncher(73 listeners = listeners,74 specs = specs,75 testFilters = testFilters,76 specFilters = specFilters,77 tags = tags,78 scripts = scripts,79 )80 @Deprecated("This class is deprecated since 5.0")81 fun withSpecFilters(filters: List<SpecFilter>): KotestEngineLauncher {82 return KotestEngineLauncher(83 listeners = listeners,84 specs = specs,85 testFilters = testFilters,86 specFilters = specFilters + filters,...
KotestEngineProperties.kt
Source:KotestEngineProperties.kt
1package io.kotest.core.internal2object KotestEngineProperties {3 const val scriptsEnabled = "kotest.framework.scripts.enabled"4 const val dumpConfig = "kotest.framework.dump.config"5 /**6 * Sets the tag expression that determines included/excluded tags.7 */8 const val tagExpression = "kotest.tags"9 const val excludeTags = "kotest.tags.exclude"10 const val includeTags = "kotest.tags.include"11 /**12 * A regex expression that is used to match the test [io.kotest.core.descriptors.Descriptor]'s path13 * to determine if a test should be included in the test plan or not.14 */15 const val filterTests = "kotest.filter.tests"16 /**17 * A regex expression that is used to match the [io.kotest.mpp.bestName] of a class18 * to determine if a spec should be included in the test plan or not....
build.gradle.kts
Source:build.gradle.kts
1import com.diffplug.gradle.spotless.SpotlessApply2import io.gitlab.arturbosch.detekt.Detekt3import org.jetbrains.kotlin.gradle.tasks.KotlinCompile4import io.gitlab.arturbosch.detekt.DetektCreateBaselineTask5@Suppress("DSL_SCOPE_VIOLATION")6plugins {7 application8 alias(libs.plugins.kotest.multiplatform)9 alias(libs.plugins.kotlin.jvm)10 alias(libs.plugins.arrowGradleConfig.formatter)11 alias(libs.plugins.arrowGradleConfig.versioning)12 alias(libs.plugins.dokka)13 alias(libs.plugins.detekt)14 alias(libs.plugins.kover)15 alias(libs.plugins.kotlin.binaryCompatibilityValidator)16}17application {18 mainClass.set("io.github.iwalker.MainKt")19}20allprojects {21 group = "io.github.iwalker"22 repositories {23 mavenCentral()24 maven(url = "https://oss.sonatype.org/content/repositories/snapshots/")25 }26 listOf(27 libs.plugins.detekt,28 libs.plugins.kover,29 libs.plugins.kotlin.jvm,30 libs.plugins.arrowGradleConfig.formatter,31 libs.plugins.arrowGradleConfig.versioning,32 libs.plugins.kotest.multiplatform,33 libs.plugins.kotlin.binaryCompatibilityValidator34 ).forEach {35 plugins.apply(it.get().pluginId)36 }37 apply(plugin = "org.gradle.idea")38 // doc configurations39 extra.set("dokka.outputDirectory", rootDir.resolve("docs"))40 tasks.configureEach {41 if (name == "build") { // a few convenience tasks when running "build"42 dependsOn(tasks.withType<Detekt>())43 dependsOn(tasks.withType<SpotlessApply>())44 dependsOn(tasks.named("apiDump"))45 }46 }47 // static analysis tool48 detekt {49 parallel = true50 buildUponDefaultConfig = true51 allRules = true52 }53 spotless {54 val userData: Map<String, String> =55 mapOf(56 "indent_size" to "2",57 "disabled_rules" to "import-ordering, no-unit-return, curly-spacing",58 "tab_width" to "2",59 "ij_continuation_indent_size" to "2",60 "max_line_length" to "off"61 )62 kotlin {63 // spotless doesn't consider .editorconfig, so instead use a userData https://github.com/diffplug/spotless/tree/main/plugin-gradle#ktlint64 ktlint().userData(userData)65 endWithNewline()66 }67 }68 kotlin {69 explicitApi()70 }71 tasks {72 withType<KotlinCompile>().configureEach {73 kotlinOptions {74 jvmTarget = "1.8"75 freeCompilerArgs += "-Xcontext-receivers"76 }77 sourceCompatibility = JavaVersion.VERSION_1_8.toString()78 targetCompatibility = JavaVersion.VERSION_1_8.toString()79 }80 test {81 maxParallelForks = Runtime.getRuntime().availableProcessors()82 useJUnitPlatform()83 // test coverage tool84 extensions.configure(kotlinx.kover.api.KoverTaskExtension::class) {85 includes = listOf("org.example.*")86 }87 testLogging {88 setExceptionFormat("full")89 setEvents(listOf("passed", "skipped", "failed", "standardOut", "standardError"))90 }91 }92 withType<Detekt>().configureEach {93 jvmTarget = "1.8"94 reports {95 html.required.set(true)96 sarif.required.set(true)97 txt.required.set(false)98 xml.required.set(false)99 }100 }101 withType<DetektCreateBaselineTask>().configureEach {102 jvmTarget = "1.8"103 }104 }105 dependencies {106 implementation(libs.arrow.fx)107 implementation(libs.coroutines.core)108 implementation(libs.kotlin.stdlibCommon)109 testImplementation(libs.kotest.frameworkEngine)110 testImplementation(libs.kotest.runnerJUnit5)111 testImplementation(libs.kotest.arrow)112 }113}114dependencies {115 implementation(libs.postgresql)116 implementation(libs.hikari)117 implementation(libs.coroutines.reactive)118 implementation(libs.coroutines.reactor)119 implementation(libs.spring.boot.starter.webflux)120 implementation(libs.reactor.kotlin.extensions)121 implementation(libs.netty.transport.native.kqueue)122 testImplementation(libs.testcontainers.postgresql)123}...
DumpTest.kt
Source:DumpTest.kt
...10import io.kotest.matchers.string.shouldInclude11import kotlin.time.Duration.Companion.seconds12@Isolate13class DumpTest : FunSpec({14 test("dump should include test timeouts") {15 ProjectConfiguration().apply {16 timeout = 1217 invocationTimeout = 3423418 projectTimeout = 44444.seconds19 }.createConfigSummary().apply {20 this.shouldInclude("Default test timeout: 12ms")21 this.shouldInclude("Default test invocation timeout: 34234ms")22 this.shouldInclude("Overall project timeout: 12h 20m 44sms")23 }24 }25 test("dump should include affinity") {26 ProjectConfiguration().apply {27 timeout = 1228 invocationTimeout = 3423429 }.createConfigSummary().apply {30 this.shouldInclude("Dispatcher affinity: true")31 }32 }33 test("dump should include test order") {34 ProjectConfiguration().apply {35 testCaseOrder = TestCaseOrder.Random36 }.createConfigSummary().apply {37 this.shouldInclude("Default test execution order: Random")38 }39 }40 test("dump should include Spec execution order") {41 ProjectConfiguration().apply {42 specExecutionOrder = SpecExecutionOrder.Annotated43 }.createConfigSummary().apply {44 this.shouldInclude("Spec execution order: Annotated")45 }46 }47 test("dump should include Duplicate test name mode") {48 ProjectConfiguration().apply {49 duplicateTestNameMode = DuplicateTestNameMode.Silent50 }.createConfigSummary().apply {51 this.shouldInclude("Duplicate test name mode: Silent")52 }53 }54 test("dump should include default isolation mode") {55 ProjectConfiguration().apply {56 isolationMode = IsolationMode.InstancePerLeaf57 }.createConfigSummary().apply {58 this.shouldInclude("Default isolation mode: InstancePerLeaf")59 }60 }61 test("dump should include failOnEmptyTestSuite") {62 ProjectConfiguration().apply {63 failOnEmptyTestSuite = true64 }.createConfigSummary().apply {65 this.shouldInclude("Fail on empty test suite: true")66 }67 }68 test("dump should include coroutineDebugProbes") {69 ProjectConfiguration().apply {70 coroutineDebugProbes = true71 }.createConfigSummary().apply {72 this.shouldInclude("Coroutine debug probe: true")73 }74 }75 test("dump should include failOnIgnoredTests") {76 ProjectConfiguration().apply {77 failOnIgnoredTests = true78 }.createConfigSummary().apply {79 this.shouldInclude("Fail on ignored tests: true")80 }81 }82 test("dump should include globalAssertSoftly") {83 ProjectConfiguration().apply {84 globalAssertSoftly = true85 }.createConfigSummary().apply {86 this.shouldInclude("Global soft assertions: true")87 }88 }89})...
dump.kt
Source:dump.kt
...37 }38 runtimeTags().expression?.let { sb.buildOutput("Tags", it) }39 return sb.toString()40}41fun ProjectConfiguration.dumpProjectConfig() {42 println("~~~ Kotest Configuration ~~~")43 println(createConfigSummary())44}45private fun StringBuilder.buildOutput(key: String, value: String? = null, indentation: Int = 0) {46 if (indentation == 0) {47 append("-> ")48 } else {49 for (i in 0 until indentation) {50 append(" ")51 }52 append("- ")53 }54 append(key)55 value?.let { append(": $it") }...
interceptors.kt
Source:interceptors.kt
1package io.kotest.engine2import io.kotest.common.KotestInternal3import io.kotest.engine.interceptors.DumpConfigInterceptor4import io.kotest.engine.interceptors.EmptyTestSuiteInterceptor5import io.kotest.engine.interceptors.EngineInterceptor6import io.kotest.engine.interceptors.KotestPropertiesInterceptor7import io.kotest.engine.interceptors.ProjectExtensionEngineInterceptor8import io.kotest.engine.interceptors.ProjectListenerEngineInterceptor9import io.kotest.engine.interceptors.ProjectTimeoutEngineInterceptor10import io.kotest.engine.interceptors.SpecSortEngineInterceptor11import io.kotest.engine.interceptors.TestDslStateInterceptor12import io.kotest.engine.interceptors.TestEngineInitializedInterceptor13import io.kotest.engine.interceptors.TestEngineStartedFinishedInterceptor14import io.kotest.engine.interceptors.WriteFailuresInterceptor15@KotestInternal16actual fun testEngineInterceptors(): List<EngineInterceptor> {17 return listOfNotNull(18 TestEngineStartedFinishedInterceptor,19 KotestPropertiesInterceptor,20 TestDslStateInterceptor,21 SpecSortEngineInterceptor,22 ProjectExtensionEngineInterceptor,23 ProjectListenerEngineInterceptor,24 ProjectTimeoutEngineInterceptor,25 EmptyTestSuiteInterceptor,26 WriteFailuresInterceptor,27 DumpConfigInterceptor,28 TestEngineInitializedInterceptor,29 )30}...
CoroutineDebugTest.kt
Source:CoroutineDebugTest.kt
...9import kotlinx.coroutines.async10import kotlinx.coroutines.delay11class CoroutineDebugTest : FunSpec() {12 init {13 test("coroutine debug should dump coroutine stacks on error") {14 val c = ProjectConfiguration()15 c.coroutineDebugProbes = true16 val output = captureStandardOut {17 TestEngineLauncher(NoopTestEngineListener)18 .withClasses(Wibble::class)19 .withConfiguration(c)20 .launch()21 .errors.shouldBeEmpty()22 }23 output shouldContain "DeferredCoroutine"24 }25 }26}27private class Wibble : FunSpec() {...
DumpConfigInterceptor.kt
Source:DumpConfigInterceptor.kt
2import io.kotest.common.KotestInternal3import io.kotest.core.config.ProjectConfiguration4import io.kotest.core.internal.KotestEngineProperties5import io.kotest.engine.EngineResult6import io.kotest.engine.config.dumpProjectConfig7import io.kotest.mpp.syspropOrEnv8/**9 * Outputs a given [ProjectConfiguration] to the console.10 */11@OptIn(KotestInternal::class)12internal object DumpConfigInterceptor : EngineInterceptor {13 override suspend fun intercept(14 context: EngineContext,15 execute: suspend (EngineContext) -> EngineResult16 ): EngineResult {17 if (syspropEnabled()) {18 context.configuration.dumpProjectConfig()19 }20 return execute(context)21 }22 private fun syspropEnabled() =23 syspropOrEnv(KotestEngineProperties.dumpConfig) != null24}...
dump
Using AI Code Generation
1+import io.kotest.engine.config.Dump2 import io.kotest.engine.config.DumpType3 import io.kotest.engine.config.DumpType.*4 import io.kotest.engine.config.KotestEngineProperties5@@ -14,6 +15,7 @@ import io.kotest.engine.config.SpecExecutionOrder6 import io.kotest.engine.config.SpecExecutionOrder.*7 import io.kotest.engine.config.SpecFilter8 import io.kotest.engine.config.SpecFilter.*9+import io.kotest.engine.config.dump10 import io.kotest.engine.config.parseSpecExecutionOrder11 import io.kotest.engine.config.parseSpecFilter12 import io.kotest.engine.config.parseSpecInstantiationOrder13@@ -41,7 +43,7 @@ import java.nio.file.Path14 import java.nio.file.Paths15 import java.util.concurrent.TimeUnit16 import kotlin.reflect.KClass17-import kotlin.reflect.full.companionObjectInstance18+import kotlin.reflect.full.companionObject19 import kotlin.reflect.full.createInstance20 import kotlin.reflect.full.superclasses21 import kotlin.reflect.jvm.jvmName22@@ -118,7 +120,7 @@ class KotestEnginePropertiesTest : FunSpec({23 test("dump should return a Dump object with the correct values") {24 System.setProperty("kotest.dump", "full")25- val dump = KotestEngineProperties.dump()26+ val dump = dump()27 dump.specs shouldBe emptyList()28 dump.listeners shouldBe emptyList()29@@ -128,7 +130,7 @@ class KotestEnginePropertiesTest : FunSpec({30 System.setProperty("kotest.dump", "full")31 System.setProperty("kotest.dump.specs", "com.example.Foo,com.example.Bar")32 System.setProperty("kotest.dump.listeners", "com.example.Baz,com.example.Qux")33- val dump = KotestEngineProperties.dump()34+ val dump = dump()35 dump.specs shouldBe listOf("com.example.Foo", "com.example.Bar")36 dump.listeners shouldBe listOf("com.example.Baz", "com.example.Qux")37@@ -147,7 +149,7 @@ class KotestEnginePropertiesTest : FunSpec({38 System.setProperty("kotest.dump", "full")39 System.setProperty("kotest.dump.specs", "com.example.Foo,com.example.Bar")
dump
Using AI Code Generation
1+import io.kotest.engine.config.Dump2+import io.kotest.engine.config.DumpType3+import io.kotest.core.config.Dump4+import io.kotest.core.config.DumpType5+import io.kotest.core.config.Dump6+import io.kotest.core.config.DumpType7+import io.kotest.core.config.Dump8+import io.kotest.core.config.DumpType9+import io.kotest.core.config.Dump10+import io.kotest.core.config.DumpType11+import io.kotest.core.config.Dump12+import io.kotest.core.config.DumpType13+import io.kotest.core.config.Dump14+import io.kotest.core.config.DumpType15+import io.kotest.core.config.Dump16+import io.kotest.core.config.DumpType17+import io.kotest.core.config.Dump18+import io.kotest.core.config.DumpType19+import io.kotest.core.config.Dump20+import io.kotest.core.config.DumpType21+import io.kotest.core.config.Dump22+import io.kotest.core.config.DumpType23+import io.kotest.core.config.Dump24+import io.kotest.core.config.DumpType25+import io.kotest.core.config.Dump26+import io.kotest.core.config
dump
Using AI Code Generation
1 val dump = Dump()2 dump.dump(config)3 val dump = Dump()4 dump.dump(config)5 val dump = Dump()6 dump.dump(config)7 val dump = Dump()8 dump.dump(config)9 val dump = Dump()10 dump.dump(config)11 val dump = Dump()12 dump.dump(config)13 val dump = Dump()14 dump.dump(config)15 val dump = Dump()16 dump.dump(config)17 val dump = Dump()18 dump.dump(config)19 }20 }21}
dump
Using AI Code Generation
1 }2 fun testDumpConfig() {3 }4 fun testDumpConfig1() {5 val dump = Dump()6 dump.dumpConfig()7 }8 fun testDumpConfig2() {9 val dump = Dump()10 dump.dumpConfig()11 }12 fun testDumpConfig3() {
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!