1

I am using Java TestNG annotation:

@Test(groups = ['integration'])

And I would like to create Kotlin annotation like:

@IntegrationTest

Is it doable ?

deamon
  • 83,933
  • 102
  • 303
  • 431
Areo
  • 878
  • 5
  • 11

1 Answers1

2

No, as of now Kotlin language doesn't have builtin tools that enable such use case.

You can resort to the annotation processing technique: write an annotation processor that replaces your custom @IntegrationTest with @Test from TestNG.

One drawback of annotation processing is that a processor is a black box to the tooling. For example, IDE won't treat the methods annotated with @IntegrationTest as tests because it doesn't know that they are going to be post-processed later.

Also annotation processing is a JVM-specific tool, so it isn't supported on other platforms.

Ilya
  • 19,764
  • 8
  • 62
  • 84