Skip to content

Commit

Permalink
Fixed a defect in the failure summary counts
Browse files Browse the repository at this point in the history
  • Loading branch information
wakaleo committed May 23, 2019
1 parent 04ffeae commit 2eeab8d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class WhenGeneratingAnEmailableReport {
}
}


@Nested
inner class ReportWithCustomFields {

Expand Down Expand Up @@ -136,7 +137,7 @@ class WhenGeneratingAnEmailableReport {
@Test
fun `should list top most unstable features`() {
val unstableFeatures = parsedReport.getElementsByClass("unstable-feature").map { element -> element.text() }
assertThat(unstableFeatures).containsExactly("Compromised scenarios", "Broken scenarios", "Failed scenarios", "Mixed scenarios")
assertThat(unstableFeatures).containsExactly("Failed scenarios", "Broken scenarios", "Compromised scenarios", "Mixed scenarios")
}
}

Expand Down Expand Up @@ -171,7 +172,7 @@ class WhenGeneratingAnEmailableReport {
@Test
fun `should list top most unstable features`() {
val unstableFeatures = parsedReport.getElementsByClass("unstable-feature").map { element -> element.text() }
assertThat(unstableFeatures).containsExactly("Compromised scenarios", "Broken scenarios", "Failed scenarios", "Mixed scenarios")
assertThat(unstableFeatures).containsExactly("Failed scenarios", "Broken scenarios", "Compromised scenarios", "Mixed scenarios")
}

@Nested
Expand All @@ -192,7 +193,7 @@ class WhenGeneratingAnEmailableReport {
@Test
fun `should list no more than the configured number of errors or unstable features`() {
val unstableFeatures = parsedReport.getElementsByClass("unstable-feature").map { element -> element.text() }
assertThat(unstableFeatures).containsExactly("Compromised scenarios", "Broken scenarios")
assertThat(unstableFeatures).containsExactly("Failed scenarios", "Broken scenarios")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@ class UnstableFeaturesBuilder(val testOutcomes: TestOutcomes) {
.groupBy { outcome -> defaultStoryNameOr(outcome.userStory?.displayName) }
.map { (userStoryName, outcomes) ->
UnstableFeature(userStoryName,
failingTestCount,
percentageFailures(failingTestCount, userStoryName, testOutcomes),
outcomes.size,
percentageFailures(outcomes.size, userStoryName, testOutcomes),
featureReport(outcomes[0]))
}
.sortedByDescending { unstableFeature -> unstableFeature.failurePercentage }
.sortedWith(compareByDescending<UnstableFeature> { it.failurePercentage }
.thenByDescending { it.failureCount })
.take(maxEntries)
}

Expand Down

0 comments on commit 2eeab8d

Please sign in to comment.