---
title: Kotlin
description: Learn how to use the Allure Kotlin extensions to add steps, metadata and attachments to Allure reports from Kotlin tests, including coroutine-aware steps.
---

# Getting started with Allure Kotlin extensions

[![Allure Kotlin extensions latest version](https://img.shields.io/maven-central/v/io.qameta.allure/allure-kotlin-extensions?style=flat "allure-kotlin-extensions")](https://mvnrepository.com/artifact/io.qameta.allure/allure-kotlin-extensions)

The Allure Kotlin extensions let you add steps, metadata and attachments to your [Allure Report](https://allurereport.org/docs/) test reports with a Kotlin-friendly API: top-level functions with named arguments and default values, steps that return values, and steps that work with coroutines.

The extensions don't run your tests. They work together with an Allure Java integration for your test framework, such as [Allure JUnit Jupiter](/docs/junit-jupiter/) or [Allure TestNG](/docs/testng/), and call the same [Runtime API](/docs/junit-jupiter-reference/) that Java tests use. The original `Allure` class stays available.

There are two modules:

- `allure-kotlin-extensions` - the Kotlin API for steps, metadata, attachments and global errors.
- `allure-kotlin-coroutines` - steps that can suspend, and a way to pass the current test to coroutines that run on other threads. This module includes `allure-kotlin-extensions`.

The Allure Kotlin extensions are available in Allure Java 3.0.0 and newer. They require Java 17 or newer and Kotlin 2.3 or newer.

Info:
The Allure Kotlin extensions are a part of [Allure Java](https://github.com/allure-framework/allure-java). They are not related to [Allure Kotlin](https://github.com/allure-framework/allure-kotlin), a separate project for Android tests.

## Setting up

1. Make sure you have the Allure Report integration enabled for the test framework you use.

   See the instructions in the integration's documentation in [Frameworks](/docs/frameworks/).

1. Add the Allure Kotlin extensions to your project's dependencies. If your tests use coroutines, use `allure-kotlin-coroutines` instead of `allure-kotlin-extensions`, to get suspending steps and to keep the steps of coroutines in the right test.

   **Maven:**
   ```xml
   <!-- Define the version of Allure you want to use via the allure.version property -->
   <properties>
       <allure.version>VERSION</allure.version>
   </properties>

   <!-- Add allure-bom to dependency management to ensure correct versions of all the dependencies are used -->
   <dependencyManagement>
       <dependencies>
           <dependency>
               <groupId>io.qameta.allure</groupId>
               <artifactId>allure-bom</artifactId>
               <version>${allure.version}</version>
               <type>pom</type>
               <scope>import</scope>
           </dependency>
       </dependencies>
   </dependencyManagement>

   <dependencies>
       <dependency>
           <groupId>io.qameta.allure</groupId>
           <artifactId>allure-kotlin-extensions</artifactId>
           <scope>test</scope>
       </dependency>
   </dependencies>
   ```

   **Gradle (Kotlin):**
   ```kts
   val allureVersion = "VERSION"

   dependencies {
       testImplementation(platform("io.qameta.allure:allure-bom:$allureVersion"))
       testImplementation("io.qameta.allure:allure-kotlin-extensions")
   }
   ```

   **Gradle (Groovy):**
   ```groovy
   def allureVersion = "VERSION"

   dependencies {
       testImplementation platform("io.qameta.allure:allure-bom:$allureVersion")
       testImplementation "io.qameta.allure:allure-kotlin-extensions"
   }
   ```

1. Import the functions you need from `io.qameta.allure.kotlin.extensions`, and use them in your tests.

   The example below shows the Allure Kotlin extensions in a JUnit Jupiter test.

   ```kotlin
   import io.qameta.allure.kotlin.extensions.attachment
   import io.qameta.allure.kotlin.extensions.feature
   import io.qameta.allure.kotlin.extensions.parameter
   import io.qameta.allure.kotlin.extensions.step
   import org.junit.jupiter.api.Assertions.assertEquals
   import org.junit.jupiter.api.Test

   class TestOrders {

       @Test
       fun testCreateOrder() {
           feature("Orders")
           val region = parameter("region", "eu-west")

           val orderId = step("Create order") {
               val id = createOrder(region)
               name("Create order $id")
               id
           }

           step("Check the order status") {
               val status = loadStatus(orderId)
               attachment(name = "status", content = status)
               assertEquals("created", status)
           }
       }
   }
   ```

   See the [reference](/docs/kotlin-reference/) for all available functions.

1. Run your tests and generate a test report the same way as you would do usually.
