1

I'm trying to convert some tests that was previously written in Junit to kotest. I need to use the FreeSpec style.

However, i cannot find a good way (not in the documentation and not after trying for several hours) to disable a test and state a reason why it was disabled.

I want to take this part of code that previously written using Junit:

class myTest {
    
    @Ignored("The test should be ignored")
    @Test
    fun `my ignored test`() {}
} 

into kotest:

class myTest: FreeSpec( {
    
    <Ignore with a reason>
    "my ignored test" {}
})

Unfortunately, The @ignore annotation (of kotest) does not except any reason message.

Does anyone knows how to ignore a test with providing a reason for that?

Thank you

Liran_k
  • 21
  • 2

1 Answers1

1

You can use .config on the test name.

class myTest: FreeSpec( {
    
    "my ignored test".config(enabledOrReasonIf = ....) {}
})
sksamuel
  • 16,154
  • 8
  • 60
  • 108