1

I am using Java TestNG annotation:

@Test(groups = ['integration'])

And I would like to create Kotlin annotation like:

@IntegrationTest

Is it doable ?

deamon
  • 89,107
  • 111
  • 320
  • 448
Areo
  • 928
  • 5
  • 12

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
  • 21,871
  • 8
  • 73
  • 92