net.serenitybdd.reports.model.FailuresByFeature.kt Maven / Gradle / Ivy
package net.serenitybdd.reports.model
import net.thucydides.model.domain.TestOutcome
import net.thucydides.model.reports.TestOutcomes
class FailuresByFeature(val featureName: String, val failures: List) {
companion object {
fun from(testOutcomes: TestOutcomes): List {
val failingOutcomesGroupedByFeature = testOutcomes.unsuccessfulTests.tests.groupBy { it.userStory }
return failingOutcomesGroupedByFeature.keys.map { userStory ->
FailuresByFeature(userStory.name, failingScenariosIn(failingOutcomesGroupedByFeature.getOrDefault(userStory, listOf())))
}.sortedBy { it.featureName }
}
private fun failingScenariosIn(testOutcomes: List): List {
return testOutcomes.map { ScenarioSummary.ofFailingScenariosIn(it) }
}
}
}