Skip to content

Commit

Permalink
Simplify getting test from batch, add support for Tag and custom Laye…
Browse files Browse the repository at this point in the history
…r annotations
  • Loading branch information
Ivan Dyatlov committed Jul 18, 2024
1 parent c7994d4 commit c568cfa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import io.qameta.allure.Epic
import io.qameta.allure.Feature
import io.qameta.allure.FileSystemResultsWriter
import io.qameta.allure.Issue
import io.qameta.allure.LabelAnnotation
import io.qameta.allure.Lead
import io.qameta.allure.Owner
import io.qameta.allure.Severity
Expand Down Expand Up @@ -158,9 +157,8 @@ class AllureReporter(
findValue<SeverityLevel>(Severity::class.java.canonicalName)?.let { list.add(ResultsUtils.createSeverityLabel(it)) }
findValue<String>(Owner::class.java.canonicalName)?.let { list.add(ResultsUtils.createOwnerLabel(it)) }
findValue<String>(Lead::class.java.canonicalName)?.let { list.add(ResultsUtils.createLabel(ResultsUtils.LEAD_LABEL_NAME, it)) }
metaProperties.filter { it.name == LabelAnnotation::class.java.canonicalName }.forEach {
list.add(ResultsUtils.createLabel(it.values["name"] as String, it.values["value"] as String))
}
findValue<String>("io.qameta.allure.junit4.Tag")?.let { list.add(ResultsUtils.createTagLabel(it)) }
findValue<String>("io.qameta.allure.Layer")?.let { list.add(ResultsUtils.createLabel("layer", it)) }

return list
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class TestRunResultsListener(
}

private fun Map.Entry<Test, AndroidTestResult>.toTestResult(device: Device): TestResult {
val testInstanceFromBatch = testBatch.tests.find { it.clazz == key.clazz && it.pkg == key.pkg && it.method == key.method }
val testInstanceFromBatch = testBatch.tests.find { it == key }
val test = key
val attachments = attachments[test] ?: emptyList<Attachment>()

Expand Down

0 comments on commit c568cfa

Please sign in to comment.