0

I would like to execute only a specific subset of tests locally to exclude slowly running integration tests. So only tests with the *Test suffix should be included, those ending with *IT should be excluded.

The official Kotest guide offers command line parameters, through the feature called conditional evaluation, but the guide mentions only Gradle. How can I use conditional evaluation with Maven or IntelliJ?

Oresztesz
  • 2,294
  • 1
  • 15
  • 26

1 Answers1

1

I just found out that you have to add a VM option in the run configuration... First, I had to click on Modify options and then Add VM options (Alt+V hotkey).

add VM options

In the VM options, I had to add -Dkotest.filter.specs=*Test (without single or double quotes). If I added single quotes (as in the reference documentation) it did not work, although I'm using Windows 10. add test filter

The documentation is a bit misleading. The VM argument -Dkotest.filter.tests is filtering based on the name parameter of the should() member function in ShouldSpec.

So a configuration -Dkotest.filter.tests=*dummy* will execute the following test case inside should() {...}:

class DoesNothingTest: ShouldSpec({
    should("do some dummy things") {
        ...
    }
})

Oresztesz
  • 2,294
  • 1
  • 15
  • 26