How to use resolveConfig class of io.kotest.engine.spec package

Best Kotest code snippet using io.kotest.engine.spec.resolveConfig


Source:resolveConfig.kt Github


Full Screen

...11/**12 * Accepts an [UnresolvedTestConfig] and returns a [ResolvedTestConfig] by completing13 * any nulls in the unresolved config with defaults from the [spec] or [ProjectConfiguration].14 */15internal fun resolveConfig(16   config: UnresolvedTestConfig?,17   xdisabled: Boolean?,18   parent: TestCase?,19   spec:Spec,20   configuration: ProjectConfiguration21): ResolvedTestConfig {22   val defaultTestConfig = spec.defaultTestConfig23      ?: spec.defaultTestCaseConfig()24      ?: configuration.defaultTestConfig25   val enabled: EnabledOrReasonIf = { testCase ->26      when {27         // if xdisabled we always override any other enabled/disabled flags28         xdisabled == true -> Enabled.disabled("Disabled by xmethod")29         config?.enabled == false -> Enabled.disabled("Disabled by enabled flag in config")...

Full Screen

Full Screen


Source:Materializer.kt Github


Full Screen

...35            spec = spec,36            type = rootTest.type,37            source = rootTest.source,38            test = rootTest.test,39            config = resolveConfig(40               config = rootTest.config,41               xdisabled = rootTest.disabled,42               parent = null,43               spec = spec,44               configuration = configuration,45            ),46            factoryId = rootTest.factoryId,47         )48      }49      return when (spec.testCaseOrder() ?: spec.testOrder ?: configuration.testCaseOrder) {50         TestCaseOrder.Sequential -> tests51         TestCaseOrder.Random -> tests.shuffled()52         TestCaseOrder.Lexicographic -> tests.sortedBy { }53      }54   }55   /**56    * Materializes a [NestedTest] into a runtime [TestCase] by attaching it to the given parent.57    */58   fun materialize(nested: NestedTest, parent: TestCase): TestCase {59      return TestCase(60         descriptor = parent.descriptor.append(,61         name =,62         spec = parent.spec,63         test = nested.test,64         source = nested.source,65         type = nested.type,66         config = resolveConfig(67            config = nested.config,68            xdisabled = nested.disabled,69            parent = parent,70            spec = parent.spec,71            configuration = configuration72         ),73         factoryId = parent.factoryId,74         parent = parent,75      )76   }77}...

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.

Most used methods in resolveConfig

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?