Skip to content

Commit

Permalink
output the number of flaky tests if there are any
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Sydney Kerckhove committed Nov 11, 2021
1 parent 7e44725 commit b097afc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sydtest/src/Test/Syd/Output.hs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ outputStats (Timed TestSuiteStats {..} timing) =
$ chunk (T.pack (show testSuiteStatFailures))
]
],
[ [ chunk "Flaky: ",
fore red $ chunk (T.pack (show testSuiteStatFlakyTests))
]
| testSuiteStatFlakyTests > 0
],
[ [ chunk "Pending: ",
fore magenta $ chunk (T.pack (show testSuiteStatPending))
]
Expand Down
9 changes: 9 additions & 0 deletions sydtest/src/Test/Syd/SpecDef.hs
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,11 @@ computeTestSuiteStats = goF []
testSuiteStatFailures = case testRunResultStatus of
TestPassed -> 0
TestFailed -> 1,
testSuiteStatFlakyTests = case testRunResultStatus of
TestFailed -> 0
TestPassed -> case testRunResultRetries of
Nothing -> 0
Just _ -> 1,
testSuiteStatPending = 0,
testSuiteStatSumTime = t,
testSuiteStatLongestTime = Just (T.intercalate "." (ts ++ [tn]), t)
Expand All @@ -203,6 +208,7 @@ computeTestSuiteStats = goF []
{ testSuiteStatSuccesses = 0,
testSuiteStatExamples = 0,
testSuiteStatFailures = 0,
testSuiteStatFlakyTests = 0,
testSuiteStatPending = 1,
testSuiteStatSumTime = 0,
testSuiteStatLongestTime = Nothing
Expand All @@ -214,6 +220,7 @@ data TestSuiteStats = TestSuiteStats
{ testSuiteStatSuccesses :: !Word,
testSuiteStatExamples :: !Word,
testSuiteStatFailures :: !Word,
testSuiteStatFlakyTests :: !Word,
testSuiteStatPending :: !Word,
testSuiteStatSumTime :: !Word64,
testSuiteStatLongestTime :: !(Maybe (Text, Word64))
Expand All @@ -226,6 +233,7 @@ instance Semigroup TestSuiteStats where
{ testSuiteStatSuccesses = testSuiteStatSuccesses tss1 + testSuiteStatSuccesses tss2,
testSuiteStatExamples = testSuiteStatExamples tss1 + testSuiteStatExamples tss2,
testSuiteStatFailures = testSuiteStatFailures tss1 + testSuiteStatFailures tss2,
testSuiteStatFlakyTests = testSuiteStatFlakyTests tss1 + testSuiteStatFlakyTests tss2,
testSuiteStatPending = testSuiteStatPending tss1 + testSuiteStatPending tss2,
testSuiteStatSumTime = testSuiteStatSumTime tss1 + testSuiteStatSumTime tss2,
testSuiteStatLongestTime = case (testSuiteStatLongestTime tss1, testSuiteStatLongestTime tss2) of
Expand All @@ -242,6 +250,7 @@ instance Monoid TestSuiteStats where
{ testSuiteStatSuccesses = 0,
testSuiteStatExamples = 0,
testSuiteStatFailures = 0,
testSuiteStatFlakyTests = 0,
testSuiteStatPending = 0,
testSuiteStatSumTime = 0,
testSuiteStatLongestTime = Nothing
Expand Down

0 comments on commit b097afc

Please sign in to comment.