Skip to content

Commit

Permalink
Fix #247 fail will screenshot actions taken in after
Browse files Browse the repository at this point in the history
  • Loading branch information
lefthandedgoat committed Mar 24, 2016
1 parent 56ddcab commit 6fae98a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
26 changes: 16 additions & 10 deletions src/canopy/runner.fs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,15 @@ let tryTest test suite func =
| ex when failureMessage <> null && failureMessage = ex.Message -> Pass
| ex -> Fail ex

let private processRunResult suite (test : Test) result =
match result with
| Pass -> pass test.Id
| Fail ex -> fail ex test suite false <| safelyGetUrl()
| Skip -> skip test.Id
| Todo -> reporter.todo test.Id
| FailFast -> ()
| Failed -> ()

let private runtest (suite : suite) (test : Test) =
if failed = false then
reporter.testStart test.Id
Expand All @@ -121,10 +130,15 @@ let private runtest (suite : suite) (test : Test) =
else if System.Object.ReferenceEquals(test.Func, skipped) then Skip
else if skipNextTest = true then Skip
else
let testResult = tryTest test suite (suite.Before >> test.Func)
let testResult =
let testResult = tryTest test suite (suite.Before >> test.Func)
match testResult with
| Fail(_) -> processRunResult suite test testResult; Failed
| _ -> testResult

let afterResult = tryTest test suite (suite.After)
match testResult with
| Fail(_) -> testResult
| Failed -> testResult
| _ -> afterResult

reporter.testEnd test.Id
Expand All @@ -134,14 +148,6 @@ let private runtest (suite : suite) (test : Test) =
failureMessage <- null
FailFast

let processRunResult suite (test : Test) result =
match result with
| Pass -> pass test.Id
| Fail ex -> fail ex test suite false <| safelyGetUrl()
| Skip -> skip test.Id
| Todo -> reporter.todo test.Id
| FailFast -> ()

let run () =
reporter.suiteBegin()
let stopWatch = new Diagnostics.Stopwatch()
Expand Down
3 changes: 2 additions & 1 deletion src/canopy/types.fs
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,5 @@ type Result =
| Fail of Exception
| Skip
| Todo
| FailFast
| FailFast
| Failed

0 comments on commit 6fae98a

Please sign in to comment.