# TMS link annotations

Annotations are special markers in code that contain metadata about code. You can use TMS link annotations to provide additional information about tests. This allows IntelliJ IDEA to link your unit tests to TMS items.

TMS link annotations enable IntelliJ IDEA to perform better analysis, for example, to find test cases that are already referenced from unit tests.

> **Tip:**
> An annotation is just a class with a declaration similar to the following:
>
>
>
>
> ```
> @interface MyAnnotation { } // Java
> annotation class MyAnnotation // Kotlin
> ```

Your project may already use an annotation that links code to the corresponding tests. If that is the case, you can proceed with [configuring IntelliJ IDEA to recognize this annotation.](#configure-settings)

If not, you can [use a third-party annotation](#use-third-party-annotation) or [create your own custom annotation](#create-custom-annotation). Both options work equally well.

Maven:

Procedure: Import a third-party annotation

1. Open `pom.xml` in the root directory of your project.

> **Tip:**
> To quickly navigate to a file, press `Ctrl+Shift+N` (Windows), `⌘ ⇧ O` (macOS), `⌘ ⇧ N` (IntelliJ IDEA Classic (macOS)), `⌘ ⇧ O` (macOS System Shortcuts), `Ctrl+Shift+N` (XWin), `Ctrl+Shift+N` (GNOME), `Ctrl+Shift+N` (KDE), `Ctrl+X, Ctrl+F` (Emacs), `Ctrl+P` (Sublime Text), `⌘ P` (Sublime Text (macOS)), `Alt+Shift+O` (NetBeans), `Ctrl+Shift+T` (Visual Studio), `⌘ ⇧ T` (Visual Studio (macOS)), `Ctrl+Shift+R` (Eclipse), `⌘ ⇧ R` (Eclipse (macOS)) and enter its name.

2. In `pom.xml`, press `Alt+Insert` (Windows), `⌘ N` (macOS), `⌃ N` (IntelliJ IDEA Classic (macOS)), `⌘ N` (macOS System Shortcuts), `Alt+Insert` (XWin), `Alt+Insert` (GNOME), `Alt+Insert` (KDE), `Alt+Insert` (Emacs), `Alt+Insert` (Sublime Text), `⌘ N` (Sublime Text (macOS)), `Alt+Insert` (NetBeans), `Alt+Insert` (Visual Studio), `⌘ ⌃ N` (Visual Studio (macOS)), `Alt+Insert` (Eclipse), `⌘ N` (Eclipse (macOS)), and select Dependency.

![Generate a dependency](https://resources.jetbrains.com.cn/help/img/idea/2026.2/aqua_tms_generate_annotation_maven.png)

3. In the tool window that opens, enter the name of the dependency, for example, `io.qameta.allure:allure-java-commons`.

Make sure to select the required dependency version and click Add.

![Selecting dependency](https://resources.jetbrains.com.cn/help/img/idea/2026.2/aqua_tms_import_annotation.png)

4. Apply the changes in the build script. For that, press `Ctrl+Shift+O` (Windows), `Ctrl+Shift+O` (macOS), `Ctrl+Shift+O` (IntelliJ IDEA Classic (macOS)), `Ctrl+Shift+O` (macOS System Shortcuts), `Ctrl+Shift+O` (XWin), `Ctrl+Shift+O` (GNOME), `Ctrl+Shift+O` (KDE), `Ctrl+Shift+O` (Emacs), `Ctrl+Shift+O` (Sublime Text), `Ctrl+Shift+O` (Sublime Text (macOS)), `Ctrl+Shift+O` (NetBeans), `Ctrl+Shift+O` (Visual Studio), `Ctrl+Shift+O` (Visual Studio (macOS)), `Ctrl+Shift+O` (Eclipse), `Ctrl+Shift+O` (Eclipse (macOS)) or click Sync Maven Changes in the notification that appears in the top-right corner of the editor.

![Loading changes](https://resources.jetbrains.com.cn/help/img/idea/2026.2/aqua_tms_import_annotation_reload_maven.png)

Gradle:

Procedure: Import a third-party annotation

1. Open `build.gradle` in the root directory of your project.

> **Tip:**
> To quickly navigate to a file, press `Ctrl+Shift+N` (Windows), `⌘ ⇧ O` (macOS), `⌘ ⇧ N` (IntelliJ IDEA Classic (macOS)), `⌘ ⇧ O` (macOS System Shortcuts), `Ctrl+Shift+N` (XWin), `Ctrl+Shift+N` (GNOME), `Ctrl+Shift+N` (KDE), `Ctrl+X, Ctrl+F` (Emacs), `Ctrl+P` (Sublime Text), `⌘ P` (Sublime Text (macOS)), `Alt+Shift+O` (NetBeans), `Ctrl+Shift+T` (Visual Studio), `⌘ ⇧ T` (Visual Studio (macOS)), `Ctrl+Shift+R` (Eclipse), `⌘ ⇧ R` (Eclipse (macOS)) and enter its name.

2. In `build.gradle`, press `Alt+Insert` (Windows), `⌘ N` (macOS), `⌃ N` (IntelliJ IDEA Classic (macOS)), `⌘ N` (macOS System Shortcuts), `Alt+Insert` (XWin), `Alt+Insert` (GNOME), `Alt+Insert` (KDE), `Alt+Insert` (Emacs), `Alt+Insert` (Sublime Text), `⌘ N` (Sublime Text (macOS)), `Alt+Insert` (NetBeans), `Alt+Insert` (Visual Studio), `⌘ ⌃ N` (Visual Studio (macOS)), `Alt+Insert` (Eclipse), `⌘ N` (Eclipse (macOS)), and select Add Maven artifact dependency.

![Generate a dependency](https://resources.jetbrains.com.cn/help/img/idea/2026.2/aqua_tms_generate_annotation_gradle.png)

3. In the tool window that opens, enter the name of the dependency, for example, `io.qameta.allure:allure-java-commons`.

Make sure to select the required dependency version and click Add.

![Selecting dependency](https://resources.jetbrains.com.cn/help/img/idea/2026.2/aqua_tms_import_annotation.png)

4. Apply the changes in the build script. For that, press `Ctrl+Shift+O` (Windows), `Ctrl+Shift+O` (macOS), `Ctrl+Shift+O` (IntelliJ IDEA Classic (macOS)), `Ctrl+Shift+O` (macOS System Shortcuts), `Ctrl+Shift+O` (XWin), `Ctrl+Shift+O` (GNOME), `Ctrl+Shift+O` (KDE), `Ctrl+Shift+O` (Emacs), `Ctrl+Shift+O` (Sublime Text), `Ctrl+Shift+O` (Sublime Text (macOS)), `Ctrl+Shift+O` (NetBeans), `Ctrl+Shift+O` (Visual Studio), `Ctrl+Shift+O` (Visual Studio (macOS)), `Ctrl+Shift+O` (Eclipse), `Ctrl+Shift+O` (Eclipse (macOS)) or click Sync Gradle Changes in the notification that appears in the top-right corner of the editor.

![Loading changes](https://resources.jetbrains.com.cn/help/img/idea/2026.2/aqua_tms_import_annotation_reload_gradle.png)

If you cannot add extra dependencies to your module, you can create your own annotation class.

Java:

Procedure: Create a custom annotation

1. In the Project tool window (`Alt+1` (Windows), `⌘ 1` (macOS), `⌘ 1` (IntelliJ IDEA Classic (macOS)), `⌘ 1` (macOS System Shortcuts), `Alt+1` (XWin), `Alt+1` (GNOME), `Alt+1` (KDE), `Alt+1` (Emacs), `Alt+1` (Sublime Text), `⌘ 1` (Sublime Text (macOS)), `Ctrl+1` (NetBeans), `Ctrl+Alt+L` (Visual Studio), `⌘ ⌥ L` (Visual Studio (macOS)), `Alt+1` (Eclipse), `Alt+1` (Eclipse (macOS))), right-click the node in which you want to create a new class and select `New | Java Class`.

2. Paste the code below to the file. You can replace `MyTmsAnnotation` with any other valid name.

```JAVA
public @interface MyTmsAnnotation {
    public String value() default "";
}
```

Kotlin:

Procedure: Create a custom annotation

1. In the Project tool window (`Alt+1` (Windows), `⌘ 1` (macOS), `⌘ 1` (IntelliJ IDEA Classic (macOS)), `⌘ 1` (macOS System Shortcuts), `Alt+1` (XWin), `Alt+1` (GNOME), `Alt+1` (KDE), `Alt+1` (Emacs), `Alt+1` (Sublime Text), `⌘ 1` (Sublime Text (macOS)), `Ctrl+1` (NetBeans), `Ctrl+Alt+L` (Visual Studio), `⌘ ⌥ L` (Visual Studio (macOS)), `Alt+1` (Eclipse), `Alt+1` (Eclipse (macOS))), right-click the node in which you want to create a new class and select `New | Kotlin Class/File`.

2. Paste the code below to the file. You can replace `MyTmsAnnotation` with any other valid name.

```KOTLIN
annotation class MyTmsAnnotation(val value: String = "")
```

After the annotation is already in the project, you need to tell the TMS plugin to use that specific annotation.

Procedure: Enable annotations in TMS settings

1. Press `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) to open settings and then select `Tools | TMS | References From Code | Java/Kotlin`.

2. Click Add ![](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.general.add.svg) to add the annotation.

![TMS settings](https://resources.jetbrains.com.cn/help/img/idea/2026.2/aqua_tms_settings.png)

3. Specify the annotation class and click OK.

![Enable annotations in settings](https://resources.jetbrains.com.cn/help/img/idea/2026.2/aqua_tms_setup_annotation.png)

Finally, for IntelliJ IDEA to establish a linkage between a unit test and a TMS item, the test needs to be annotated with one of the annotations configured for the project.

Java:

Procedure: Annotate a unit test

1. Open the unit test file in the editor.

2. Put a TMS link annotation before the method definition as shown below.

```JAVA
// C58439
@MyTmsAnnotation("C58439")
@Test
void TestCase1() {
    Assertions.assertEquals(4, Calculator.multiply(2,2));
}
```

Kotlin:

Procedure: Annotate a unit test

1. Open the unit test file in the editor.

2. Put a TMS link annotation before the method definition as shown below.

```KOTLIN
// C58439
@MyTmsAnnotation("C58439")
@Test
fun TestCase1() {
    Assertions.assertEquals(4, Calculator.multiply(2,2))
}
```

