diff --git a/src/main/kotlin/ru/iopump/kotest/allure/annotation/KJira.kt b/src/main/kotlin/ru/iopump/kotest/allure/annotation/KJira.kt index 3bd6db0..f2a8945 100644 --- a/src/main/kotlin/ru/iopump/kotest/allure/annotation/KJira.kt +++ b/src/main/kotlin/ru/iopump/kotest/allure/annotation/KJira.kt @@ -1,6 +1,8 @@ package ru.iopump.kotest.allure.annotation +import io.qameta.allure.LabelAnnotation import io.qameta.allure.LinkAnnotation +import ru.iopump.kotest.allure.api.KotestAllureConstant.JIRA.LABEL_NAME import ru.iopump.kotest.allure.api.KotestAllureConstant.JIRA.LINK_TYPE import java.lang.annotation.Inherited @@ -9,5 +11,6 @@ import java.lang.annotation.Inherited @Retention(AnnotationRetention.RUNTIME) @Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION) @LinkAnnotation(type = LINK_TYPE) +@LabelAnnotation(name = LABEL_NAME) @Repeatable annotation class KJira(val value: String) \ No newline at end of file diff --git a/src/main/kotlin/ru/iopump/kotest/allure/annotation/KTag.kt b/src/main/kotlin/ru/iopump/kotest/allure/annotation/KTag.kt new file mode 100644 index 0000000..3af12e8 --- /dev/null +++ b/src/main/kotlin/ru/iopump/kotest/allure/annotation/KTag.kt @@ -0,0 +1,13 @@ +package ru.iopump.kotest.allure.annotation + +import io.qameta.allure.LabelAnnotation +import io.qameta.allure.util.ResultsUtils.TAG_LABEL_NAME +import java.lang.annotation.Inherited + +@MustBeDocumented +@Inherited +@Retention(AnnotationRetention.RUNTIME) +@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION) +@LabelAnnotation(name = TAG_LABEL_NAME) +@Repeatable +annotation class KTag(val value: String) diff --git a/src/main/kotlin/ru/iopump/kotest/allure/annotation/KTags.kt b/src/main/kotlin/ru/iopump/kotest/allure/annotation/KTags.kt new file mode 100644 index 0000000..f18e379 --- /dev/null +++ b/src/main/kotlin/ru/iopump/kotest/allure/annotation/KTags.kt @@ -0,0 +1,15 @@ +package ru.iopump.kotest.allure.annotation + +import java.lang.annotation.Inherited + +@MustBeDocumented +@Inherited +@Retention(AnnotationRetention.RUNTIME) +@Target( + AnnotationTarget.FUNCTION, + AnnotationTarget.PROPERTY_GETTER, + AnnotationTarget.PROPERTY_SETTER, + AnnotationTarget.ANNOTATION_CLASS, + AnnotationTarget.CLASS +) +annotation class KTags(val value: Array) \ No newline at end of file diff --git a/src/main/kotlin/ru/iopump/kotest/allure/api/KotestAllureConstant.kt b/src/main/kotlin/ru/iopump/kotest/allure/api/KotestAllureConstant.kt index 5c975ca..2f2460c 100644 --- a/src/main/kotlin/ru/iopump/kotest/allure/api/KotestAllureConstant.kt +++ b/src/main/kotlin/ru/iopump/kotest/allure/api/KotestAllureConstant.kt @@ -16,6 +16,8 @@ object KotestAllureConstant { object JIRA { const val LINK_TYPE = "jira" + + const val LABEL_NAME = "jira" internal const val PATTERN_DEFAULT = "\\[([a-zA-Z]+-\\d+)]" diff --git a/src/main/kotlin/ru/iopump/kotest/allure/helper/meta/AllureMetadata.kt b/src/main/kotlin/ru/iopump/kotest/allure/helper/meta/AllureMetadata.kt index d7343aa..8500c64 100644 --- a/src/main/kotlin/ru/iopump/kotest/allure/helper/meta/AllureMetadata.kt +++ b/src/main/kotlin/ru/iopump/kotest/allure/helper/meta/AllureMetadata.kt @@ -7,6 +7,7 @@ import io.qameta.allure.model.Link import ru.iopump.kotest.allure.helper.meta.AllureMetadataSupportDescriptions.kDescription import ru.iopump.kotest.allure.helper.meta.AllureMetadataSupportLabels.allureIdsFromTestName import ru.iopump.kotest.allure.helper.meta.AllureMetadataSupportLabels.epicFromPkg +import ru.iopump.kotest.allure.helper.meta.AllureMetadataSupportLabels.jiraLabelsFromTestName import ru.iopump.kotest.allure.helper.meta.AllureMetadataSupportLabels.labelAnnotations import ru.iopump.kotest.allure.helper.meta.AllureMetadataSupportLabels.severity import ru.iopump.kotest.allure.helper.meta.AllureMetadataSupportLinks.issues @@ -28,6 +29,7 @@ internal class AllureMetadata( add(specClass.severity) add(specClass.epicFromPkg) addAll(description.allureIdsFromTestName) + addAll(description.jiraLabelsFromTestName) }.filterNotNull() internal val allLinks: List = buildList { diff --git a/src/main/kotlin/ru/iopump/kotest/allure/helper/meta/AllureMetadataSupportLabels.kt b/src/main/kotlin/ru/iopump/kotest/allure/helper/meta/AllureMetadataSupportLabels.kt index e3bb602..5cbb2e5 100644 --- a/src/main/kotlin/ru/iopump/kotest/allure/helper/meta/AllureMetadataSupportLabels.kt +++ b/src/main/kotlin/ru/iopump/kotest/allure/helper/meta/AllureMetadataSupportLabels.kt @@ -8,6 +8,7 @@ import io.qameta.allure.model.Label import io.qameta.allure.util.AnnotationUtils import io.qameta.allure.util.ResultsUtils.* import ru.iopump.kotest.allure.api.KotestAllureConstant +import ru.iopump.kotest.allure.api.KotestAllureConstant.JIRA import ru.iopump.kotest.allure.helper.meta.AllureMetadataSupport.findAll import kotlin.reflect.KClass import kotlin.reflect.full.findAnnotation @@ -28,4 +29,12 @@ internal object AllureMetadataSupportLabels { .map { key -> createLabel(ALLURE_ID_LABEL_NAME, key) } .toList() }.orEmpty() + + internal inline val Descriptor?.jiraLabelsFromTestName: Collection