How to use StringBuilder.buildOutput method of io.kotest.engine.config.dump class

Best Kotest code snippet using io.kotest.engine.config.dump.StringBuilder.buildOutput


Source:dump.kt Github


Full Screen

1package io.kotest.engine.config2import io.kotest.core.config.ProjectConfiguration3import io.kotest.engine.tags.runtimeTags4import io.kotest.mpp.bestName5fun ProjectConfiguration.createConfigSummary(): String {6 val sb = StringBuilder()7 sb.buildOutput("Parallelization factor", parallelism.toString())8 sb.buildOutput("Concurrent specs", concurrentSpecs.toString())9 sb.buildOutput("Global concurrent tests", concurrentTests.toString())10 sb.buildOutput("Dispatcher affinity", dispatcherAffinity.toString())11 sb.buildOutput("Coroutine debug probe", coroutineDebugProbes.toString())12 sb.buildOutput("Spec execution order", sb.buildOutput("Default test execution order", sb.buildOutput("Default test timeout", timeout.toString() + "ms")15 sb.buildOutput("Default test invocation timeout", invocationTimeout.toString() + "ms")16 if (projectTimeout != null)17 sb.buildOutput("Overall project timeout", projectTimeout.toString() + "ms")18 sb.buildOutput("Default isolation mode", sb.buildOutput("Global soft assertions", globalAssertSoftly.toString())20 sb.buildOutput("Write spec failure file", writeSpecFailureFile.toString())21 if (writeSpecFailureFile) {22 sb.buildOutput("Spec failure file path",23 specFailureFilePath.replaceFirstChar { if (it.isLowerCase()) it.titlecase() else it.toString() })24 }25 sb.buildOutput("Fail on ignored tests", failOnIgnoredTests.toString())26 sb.buildOutput("Fail on empty test suite", failOnEmptyTestSuite.toString())27 sb.buildOutput("Duplicate test name mode", if (includeTestScopeAffixes != null)29 sb.buildOutput("Include test scope affixes", includeTestScopeAffixes.toString())30 sb.buildOutput("Remove test name whitespace", removeTestNameWhitespace.toString())31 sb.buildOutput("Append tags to test names", testNameAppendTags.toString())32 if (registry.isNotEmpty()) {33 sb.buildOutput("Extensions")34 registry.all().map(::mapClassName).forEach {35 sb.buildOutput(it, indentation = 1)36 }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") }56 append("\n")57}58private fun mapClassName(any: Any) = any::class.bestName()...

Full Screen

Full Screen


Using AI Code Generation


Full Screen

1import io.kotest.core.config.Project2fun main() {3 val sb = StringBuilder()4 Project.dump(sb)5 println(sb.toString())6}7kotest {

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:


You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Kotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?